FTP servers are widely used. So let's introduce how to create an FTP server. In practice, the FTP server must provide the upload and download functions. In addition, for security considerations, user authentication, user permission settings, and space management are also required. Next we will build such an FTP server.
Create an FTP server 1. Create a welcome message. If you want to see a welcome message or an introduction to this directory when entering the directory, you can use the following methods.
Check whether dirmessage_enable = YES is in the/etc/vsftpd. conf file. By default, Red Hat 9.0 has this setting. Add a file named. message in the directory. In this example, create a. message file in the/home/ylg directory with the content "Welcome to my FTP site ".
Create an FTP server 2. Change the default port of the FTP server. Change the default port 21 to port 2121 based on security considerations. Use vi to open/etc/vsftpd. conf:
- #vi /etc/vsftpd/vsftpd.conf
Add the following line at the end of the file:
- listen_port=2121
Create an FTP Server 3. Cancel anonymous logon. Find the following line in the vsftpd. conf file and change its value to "NO ":
- anonymous_enable=YES
Create an FTP server 4. Set the user to not change the directory. This is also based on security considerations. Generally, the user's default directory is/home/username. If you do not want users to switch to the first-level directory/home after logon, you can use the following settings. Find the following three lines in the/etc/vsftpd. conf file:
- #chroot_list_enable=YES
- # (default follows)
- #chroot_list_file=/etc/vsftpd.chroot_list
Change it:
- chroot_list_enable=YES
- # (default follows)
- chroot_list_file=/etc/vsftpd/chroot_list
Add a file/etc/vsftpd/chroot_list with two usernames:
- ylg
- user1
Create an FTP Server 5. limit the speed for different users. Assume that ylg can use a maximum speed of kb/s, and user1 can use a maximum speed of kb/s, you can set it in the following ways. Add the following line at the end of the/etc/vsftpd. conf file:
- user_config_dir=/etc/vsftpd/userconf
Add a directory named/etc/vsftpd/userconf:
- #mkdir /etc/vsftpd/userconf