Aliyun cloud server Linux system FTP server setup tutorial
- 2020-05-12 06:33:34
- OfStack
1. Redhat/CentOS install vsftp software
1. Update the yum source
First you need to update the system yum source, convenient tool to download address: / / www ofstack. com article / 54840. htm (shell script)
2. Install vsftp
Install vsftp using the yum command
#yum install vsftpd -y
3. Add the ftp account and directory
First check the location of nologin under 1, usually under /usr/sbin/nologin or /sbin/nologin.
Create an account using the following command, which specifies /alidata/www/wwwroot as the home directory of user pwftp. You can define the account name and directory yourself:
#useradd -d /alidata/www/wwwroot -s /sbin/nologin pwftp
Change the account password:
#passwd pwftp
Changes permissions for the specified directory
#chown -R pwftp.pwftp /alidata/www/wwwroot
4. Configuration vsftp
Edit the vsftp configuration file with the following commands:
#vi /etc/vsftpd/vsftpd.conf
Change "anonymous_enable=YES" in the configuration file to "anonymous_enable=NO"
Uncomment the following configuration:
local_enable=YES
write_enable=YES
chroot_local_user=YES
To save the changes, press ESC and enter: wq
5. Modify the shell configuration
vi edits /etc/shells, and appends it if the file does not contain /usr/sbin/nologin or /sbin/nologin (depending on the current system configuration)
6. Start the vsftp service and test login
Use the command to start the vsftp service:
#service vsftpd start
Then use the account pwftp to test whether you can log in ftp. The directory is /alidata/www/wwwroot.
2. Ubuntu/Debian install vsftp software
1. Update the software source
First you need to update the system software sources, convenient tool to download address: / / www ofstack. com article / 54840. htm (shell script)
2. Install vsftp
Install vsftp using the apt-get command
#apt-get install vsftpd -y
3. Add the ftp account and directory
First check the location of nologin under 1, usually under /usr/sbin/nologin or /sbin/nologin.
Create an account using the following command, which specifies /alidata/www/wwwroot as the home directory of user pwftp. You can define the account name and directory yourself:
#useradd -d /alidata/www/wwwroot -s /sbin/nologin pwftp
Change the account password:
#passwd pwftp
Changes permissions for the specified directory
#chown -R pwftp.pwftp /alidata/www/wwwroot
4. Configuration vsftp
Edit the vsftp configuration file with the following commands:
#vi /etc/vsftpd.conf
Change "anonymous_enable=YES" in the configuration file to "anonymous_enable=NO"
Uncomment the following configuration:
local_enable=YES
write_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
Save the exit
Edit the file /etc/ vsftpd.chroot_list, add the account name of ftp, and save to exit
5. Modify the shell configuration
vi edit /etc/shells, if the file does not include /usr/sbin/nologin or /sbin/nologin (depending on the current system configuration), append it
6. Restart vsftp service and test login
Start the vsftp service with the command:
#service vsftpd restart
Then use the account pwftp to test whether you can log in ftp. The directory is /alidata/www/wwwroot.