Installing Vsftp
- Installing vsftp with the Yum command
#vsftpd-y
add FTP account and directory
- First check the location of the nologin, usually under/usr/sbin/nologin (*nologin role is to restrict some users to the Shell landing system)
- Create an account using the following command, which specifies the home directory/home/lvstatic for the user lxftp:
#useradd-D/home/lvstatic-s/usr/sbin/nologin lxftp
- Modify the account password:
#passwd lxftp
- Modify permissions for the specified directory
#Chown -R lxftp/home/lvstatic
Configure Vsftp
- Edit the Vsftp configuration file with the following command:
#VI /etc/vsftpd/vsftpd.conf
- Change "Anonymous_enable=yes" in the configuration file to "Anonymous_enable=no"
Remove the comment symbol before the following configuration:
Local_enable=yes
Write_enable=yes
Chroot_local_user=yes
Save changes
Modify Shell Configuration
- VI Edit/etc/shells, if there is no/usr/sbin/nologin in the file, append it.
Start the VSFTP service and test the login
- To start the VSFTP service with a command:
#service vsftpd Start
Then use the Account LXFTP test whether you can login ftp, directory is/home/lvstatic.
If the client connection times is wrong: "OOPS:vsftpd:refusing to run with writable root inside Chroot ()"
Modify the VSFTPD configuration file on the server vsftpd.conf
Vim/etc/vsftpd/vsftpd.conf
Add a line configuration Allow_writeable_chroot=yes and then save the exit, restart the VSFTP service (services vsftpd restart)
Note: With respect to permissions, FTP users must have read and write access to each layer of his or her directory recursively.
chmod 777 Directory name or chmod–r 777 directory name
Turn on log function
VI /etc/vsftpd.conf
#xferlog_enable =yes #表示启用日志功能
#xferlog_file =/var/log/vsftpd.log #设置日志存放位置 for:/var/log/vsftpd.log
- Restart FTP effective configuration
Service VSFTPD Restart
Linux system VSFTPD Build FTP