FTP build under linux

1. Check whether the ftp command is installed in Linux: rpm -qa|grep vsftpd
2. Uninstall the ftp command under Linux: rpm -e vsftpd 3.
Install the ftp command under Linux: yum -y install vsftpd
4. Set it to start
    chkconfig vsftpd on
5.vsftpd start service command start | stop | restart
  service vsftpd restart
6.vsftpd configuration directory /etc/vsftpd

7. Modify
the main configuration file of Ftp to /etc/vsftpd/vsftpd.conf, use vim /etc/vsftpd/ The vsftpd.conf command edits the configuration file
  and modifies anonymous_enable=NO, the default is YES, when this setting is NO, anonymous user login is prohibited, as shown below,

enable chroot_local_user=YES

9. Set the vsftp account
useradd -d ftp root directory -s /sbin /nologin username
10. Set the password for the added account
passwd username
11. If an error 503 occurs during user authentication during the software test connection process, it should be a problem with the selinux settings: you can use the following command to check
getsebool -a | grep ftp
shows the following:
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
allow_tftp_anon_write --> off
ftp_home_dir --> off
ftpd_connect_db --> off
ftpd_disable_trans --> off
ftpd_is_daemon --> on
httpd_enable_ftp_server --> off
This is a problem of selinux, we only need to turn on the value of ftp_home_dir to on: allow_ftpd_full_access can also be turned on at the same time.
setsebool -P ftp_home_dir 1
setsebool -P allow_ftpd_full_access 1

12. The next step is to set the permissions of the ftp user. A new /etc/vsftpd folder will be added under the /etc/ folder of the system.
There is a vsftpd.conf configuration under the vsftpd folder. The file and permissions are all modified in this.




Modify configuration file
chroot_local_user=YES
chroot_list_enable=YES
and add local_root=/home/ftp at the end of the configuration file
If you only want some users to only have access to their own directories, and other users do not have this restriction, then you need to add this user to the chroot_list file (this file is usually in /etc/vsftpd/).
chown -R testftp:testftp /home/ftp Change the owner permission of the directory (that is, assign the permission of the directory to ftp)
chmod 766 /home/ftp Change the read and write permission of the directory Touch the chroot_list file
under  /etc/vsftpd/ and then write testftp in the file to
restart ftp: service vsftpd restart








Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326413537&siteId=291194637