Ø How to Install and Configure vsftpd on Red Hat/CentOS
1. Update the Yum Repository
First, you need to update the system’s yum repository. A convenient tool is available for download here: http://help.aliyun.com/manual?&helpId=1692
2. Install vsftpd
Install vsftpd using the yum command:
#yum install vsftpd -y
3. Add FTP User and Directory
First, check the location of nologin; it is usually found under /usr/sbin/nologin or /sbin/nologin.
Use the following command to create an account. This command sets /alidata/www/wwwroot as the home directory for the user pwftp. You can define your own username and directory:
#useradd -d /alidata/www/wwwroot -s /sbin/nologin pwftp
Set a password for this account:
#passwd pwftp
Modify permissions for the designated directory:
#chown -R pwftp.pwftp /alidata/www/wwwroot
4. Configure vsftpd
Edit the vsftpd configuration file with the following command:
#vi /etc/vsftpd/vsftpd.conf
In the configuration file, change ”anonymous_enable=YES “ to “anonymous_enable=NO”
Uncomment the following lines by removing the preceding comment character:
local_enable=YES
write_enable=YES
chroot_local_user=YES
Save the changes by pressing the ESC key and typing :wq
5. Modify Shell Configuration
Edit /etc/shells with vi. If /usr/sbin/nologin or /sbin/nologin (depending on your current system configuration) is not listed in the file, append it.
6. Start the vsftpd Service and Test Login
Start the vsftpd service with the command:
#service vsftpd start
Then test logging into FTP using the account pwftp. The directory is /alidata/www/wwwroot.
Ø How to Install and Configure vsftpd on Ubuntu/Debian
1. Update the Software Source
First, you need to update the system’s software sources. A convenient tool is available for download here: http://help.aliyun.com/manual?&helpId=1692
2. Install vsftpd
Install vsftpd using the apt-get command:
#apt-get install vsftpd -y
3. Add FTP User and Directory
First, check the location of nologin; it is usually found under /usr/sbin/nologin or /sbin/nologin.
Use the following command to create an account. This command sets /alidata/www/wwwroot as the home directory for the user pwftp. You can define your own username and directory:
#useradd -d /alidata/www/wwwroot -s /sbin/nologin pwftp
Set a password for this account:
#passwd pwftp
Modify permissions for the designated directory:
#chown -R pwftp.pwftp /alidata/www/wwwroot
4. Configure vsftpd
Edit the vsftpd configuration file with the following command:
#vi /etc/vsftpd.conf
In the configuration file, change ”anonymous_enable=YES “ to “anonymous_enable=NO”
Uncomment the following lines by removing the preceding comment character:
local_enable=YES
write_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
Save and exit.
Edit the /etc/vsftpd.chroot_list file, add the FTP username into it, then save and exit.
5. Modify Shell Configuration
Edit /etc/shells with vi. If /usr/sbin/nologin or /sbin/nologin (depending on your current system configuration) is not listed in the file, append it.
6. Restart the vsftpd Service and Test Login
Restart the vsftpd service with the command:
#service vsftpd restart
Then test logging into FTP using the account pwftp. The directory is /alidata/www/wwwroot.