Use linux to do FTP server (1)


FTP is short for file transfer protocol. It defines the way to transfer files from one computer to another on the network. Almost all common system platforms provide FTP service programs and client programs. The FTP server is a wu-ftpd service developed by the University of Washington.

First, install
First you can check the location /usr/sbin/in.ftpd file exists, if this file already exists, it indicates that the necessary FTP software has been installed in this system, otherwise you can Get its rpm package from the distribution and install it (of course, log in as root). Run the following command line:
# rpm –i wu-ftpd-xxxi386.rpm
If you plan to provide anonymous access, you should also install another package:
# rpm –i anonftp-xxx I386.rpm
After installation, you can simply test the server:
#ftp [hostname]
If the correct connection information appears, and you are prompted to enter the corresponding username and password, finally enter ftp> At the prompt, the installation is correct. You can type bye at the ftp> prompt to leave FTP.

Second, the working description of FTP
Whenever the FTP port (the default is port 21) receives the connection request, it will call the FTP control file - /etc/inetd.conf, When a connection is detected, the FTP daemon, /usr/sbin/in.ftpd, is called to start the session. During the server initialization process, the client must provide a valid account and password. By default, two accounts are specified—anonymous and ftp are used as access to public files. If you use your own account to access the FTP server, the FTP server will perform a routine check to make sure the user has a valid shell, otherwise the user will be denied access to the system. If you want to make a new shell valid, add it to the /etc/shells list.

Users who use their own account enter the system and are located in their home directory. After the anonymous user enters the system, it defaults to /home/ftp. After that, FTP will execute a system call (chroot), which will root the FTP. The directory becomes the user's home directory and access to other directories in the system is denied. But this change will cause the server to see some of the necessary files, such as /etc/passwd and /bin/ls. To solve this problem, the anonftp package creates the bin, etc, and lib directories in the /home/ftp directory, and places the necessary libraries and programs in it.

Copyright © Windows knowledge All Rights Reserved