File Transfer Protocol (FTP) is one of the most common network services in UNIX. Setting up an anonymous server is fairly straightforward. Setting up a virtual FTP host and a separate FTP account setting requires some skill.
1. Anonymous FTP
This is the most common service: a single machine is a separate FTP server. Most UNIX versions will automatically complete this setting: the FTP root directory is usually/home/ftp
If, for some reason, the anonymous FTP service is not set up on your machine, its settings work as follows:
The ~ftp in the following narration is the home directory of the anonymous FTP user specified in the passwd file.
The FTP daemon, FTPD, identifies the anonymous user and adjusts the account appropriately, and the access root is set to ~ftp. This means that users can only access files and directories in ~ftp. There are, of course, more restrictions. Because the root of the file system has been modified, several directories and files need to be set up to meet the minimum functional requirements.
The owner of the ~ftp should be root and only root can write.
The owner of the ~ftp/bin should also be root and only root can write. It should contain the LS program. ~ftp/bin/ls's owner should be root, and its access should be-x-x-x mode, if not, it can be modified with chmod-~ftp/bin/ls.
~ftp/lib should contain libc.so.5. This content can be found in the Lib directory.
If you intend to have the list translate user and group IDs into names, you need to create a ~/ftp/etc directory. It should have 755 access rights and should contain the passwd and group files associated with the name and ID. The encrypted password field is not used and should be empty. The only fields that need to be present are userhttp://www.aliyun.com/zixun/aggregation/11696.html ">name,uid, and GID."
The upload and download directory ~ftp/pub should have 755 access mode, and the owner should be FTP. This allows other people to upload content to the directory or read from the directory. You can, of course, modify ownership and access rights as you wish.
The FTP user's entry in passwd should be:
ftp: *: 14:50:ftp User:/home/ftp;
FTP is a inetd-controlled service, so there is also a corresponding entry in the/etc/services. is generally set up, if not, you can manually add the next item:
FTP 21/tcp
2. FTP access for other users in the system
When other user accounts (not anonymous or FTP) connect to the system, three conditions must be met to grant access.
(1) The username and password must be valid.
(2) The username must not be in/etc/ftpusers.
(3) The user must have a valid shell, which means that his shell must appear in the/etc/shells list.