Overview:
Vsftpd is a well-known FTP server in Linux. Of course, it is preferred to build an FTP server. This article describes how to install vsftpd in CentOS 6.4 and configure a virtual user to log on to FTP.
Install vsftpd
Check whether vsftpd has been installed
Rpm-qa | grep vsftpd
If not, install and set the startup
Yum-y install vsftpd
Chkconfig vsftpd on
Modify configuration file
Vim/etc/vsftpd. conf
Anonymous_enable = NO // set that anonymous access is not allowed
Local_enable = YES // set that the local user can access. Note: if a virtual host user is used, all virtual users cannot access the project if the project is set to NO.
Chroot_list_enable = YES // prevents the user from leaving the main directory
Ascii_upload_enable = YES
Ascii_download_enable = YES // sets the support for uploading and downloading in ASCII mode.
Pam_service_name = vsftpd // PAM authentication file name. PAM will be authenticated according to/etc/pam. d/vsftpd
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.
Open the vsftpd configuration file.
# 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
Add the user ftpuser to the/home/wwwroot/ftpuser directory to prohibit SSH access.
Useradd-d/home/wwwroot/ftpuser-g ftp-s/sbin/nologin ftpuser
Set user password
Passwd ftpuser
Edit the chroot_list file
Vi/etc/vsftpd/chroot_list
`
The content is the ftp user name, and each user occupies one line, for example:
Peter
John
Restart vsftpd
Service vsftpd restart
Error 1, 500 OOPS: cannot change directory
Solution:
Enter the following command on the terminal:
Setsebool-P ftpd_disable_trans 1
Service vsftpd restart
Cause: selinux is enabled on the server, which limits FTP logon.