Install VSFTPD Package [[email protected]~]# Yum Install vsftpd-y [[email protected]~]# Yum Install DB4 db4-Utils establishing a host user for VSFTPD services [email protected]~]# Useradd vir-s/sbin/Nologin Creating log files [[email protected]~]# Touch/var/log/Vsftpd.log[[email protected]~]# chown vir:vir/var/log/Vsftpd.log Modifying the vsftp profile [email protected]~]# vi/etc/vsftpd/vsftpd.conf# does not allow anonymous access to anonymous_enable=no# Local Users can access local_enable=yes# user cannot leave the home directory chroot_list_enable=yes# allow uploading ascii_upload_enable=yes# supports the download function of ASCII mode ascii_download_enable=yes# Don't forget to add Pam_service_name=vsftpd# Manually enter the following parameters and values # Turn on the functionality of the virtual user guest_enable=yes# The host user of the specified virtual user guest_username=Viruser_config_dir=/etc/vsftpd/vuser_conf#vsftpd the Service log save path, default does not exist Xferlog_file=/var/log/Vsftpd.log Create a virtual user list file [email protected]~]# vi/etc/vsftpd/vsftp_users.conf# Enter odd behavior account number, even if the password yb1 #账号abcd1234 #密码yb2abcd1234生成认证文件db_load can not find the first installation DB4-utils (yum install DB4 db4-utils) [[email protected]~]# db_load-t-T hash-f/etc/vsftpd/vsftp_users.conf/etc/vsftpd/vsftp_users.db Modify its permissions [[email protected]~]# chmod -/etc/vsftpd/vsftp_users.db Edit the authentication file, empty or annotate all the contents of the file (keep the first line) [email protected]~]# vi/etc/pam.d/after the vsftpd is emptied, the auth required pam_userdb.so db is lost.=/etc/vsftpd/Vsftp_usersaccount required pam_userdb.so db=/etc/vsftpd/vsftp_users Setting up a virtual user Profile store location [email protected]~]# mkdir/etc/vsftpd/vuser_conf/Custom Users (you can set different virtual user permissions, etc.) [email protected]~]# vi/etc/vsftpd/vuser_conf/YB1 Add the following content Local_root=/data01/yb1 #虚拟用户yb2根目录write_enable=Yesanon_umask=022anon_world_readable_only=noanon_upload_enable=yesanon_mkdir_write_enable=yesanon_other_write_enable=Yes[[email protected]~]# vi/etc/vsftpd/vuser_conf/YB2 Add the following content Local_root=/data01/yb2 #虚拟用户yb2根目录write_enable=Yesanon_umask=022anon_world_readable_only=noanon_upload_enable=yesanon_mkdir_write_enable=yesanon_other_write_enable=Yesok, start or restart Vsftp[[email protected] ~]# systemctl vsftpd Restart (restart restart) If you are prompted with an error when connecting to FTP: VSFTPD530Login Incorrect reasons:/etc/vsftpd.conf parameter Configuration there is a space solution: remove the space to connect to the FTP if the prompt error: -OOPS:vsftpd:refusing to run with writable root inside chroot () Reason: The vsftpd security rule is that FTP users are not allowed to have writable access to the FTP root directory, Therefore, the FTP user was rejected by the server. Workaround: chmod a-w/data01/Yb1chmod a-w/data01/yb2
RHEL7--Linux build FTP virtual user