As an FTP server, vsftpd is very common in Linux systems. The following describes how to install vsftp on centos.
What is vsftpd?
Vsftpd is the most popular FTP server program in the Linux release. Features: small, light, secure, and easy to use.
The name of vsftpd stands for "very secure FTP daemon". Security is one of the top concerns of Chris Evans, its developer. At the beginning of the FTP server design and development, high security is a goal.
Install vsftpd
1. Run the following command as the administrator (Root ):
- Yum install vsftpd
2. Set vsftpd FTP service to start upon startup
- Chkconfig vsftpd on
3. Start the vsftpd service
- Service vsftpd start
Manage vsftpd commands:
Stop vsftpd: Service vsftpd stop
Restart vsftpd: Service vsftpd restart
Configure Firewall
Open the/etc/sysconfig/iptables File
- VI/etc/sysconfig/iptables
Add the following code before the reject line
- -A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 21-J accept
Save and close files and restart Firewall
- Service iptables start
Configure the vsftpd Server
The default configuration file is/etc/vsftpd. conf. You can open it in a text editor.
- VI/etc/vsftpd. conf
Add an FTP user
Add the ftpuser user and set the root directory to/home/wwwroot/ftpuser. Disable the user from logging on to SSH and restrict access to other directories.
1. Modify/etc/vsftpd. conf.
Set the following three lines
- # Chroot_list_enable = Yes
- # (Default follows)
- # Chroot_list_file =/etc/vsftpd. chroot_list
Change
- Chroot_list_enable = Yes
- # (Default follows)
- Chroot_list_file =/etc/vsftpd/chroot_list
3. Add the user ftpuser and point to the/home/wwwroot/ftpuser directory. disable SSH access.
- Useradd-D/home/wwwroot/ftpuser-g ftp-S/sbin/nologin ftpuser
4. Set the User Password
- Passwd ftpuser
5. edit the file chroot_list:
- VI/etc/vsftpd/chroot_list
The content is the FTP user name, and each user occupies one line, for example:
User11
6. Restart vsftpd.
- Service vsftpd restart
In addition, you can use scripts officially released by centos to manage FTP usernames in the future. The address is as follows:
Http://wiki.centos.org/HowTos/Chroot_Vsftpd_with_non-system_users
7. Pay attention to user permission Configuration
Chmod 755/home/wwwroot/ftpuser