The entire process of installing the ftp server on the CentOS 7 system
- 2020-05-27 08:00:52
- OfStack
After many detours during the installation and configuration process, I will summarize it briefly. Convenient for everyone to learn reference. The installation steps are as follows:
1. Install ftp. I believe this step is simple
# yum -y install ftp vsftpd
View the installation
#rpm -qc vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
2. Server configuration
Create ftp root /ftp/private (there is a puzzle here, if you create a /root/ftp/private directory, you will be prompted 500 OOPS when you log in: cannot change directory: / root/ftp/private such mistakes, now unable to solve, hope to have a friend know explain 1 below), if you create a public directory, you need to create/ftp/open and in/etc vsftpd/vsftpd conf increase
anon_root=/ftp/open
#mkdir /ftp
#mkdir /ftp/private
Create a password plaintext file and create two users John, Jack, passwxx, passwyy
#vim /etc/vsftpd/pass.txt
John
passwxx
Jack
passwyy
Create the password DB file from the clear text, and userlist.db is the database of user passwords
#db_load -T -t hash -f /etc/vsftpd/pass.txt \
> /etc/vsftpd/userlist.db
Create vftpd system account ftp_user
#useradd -d /root/ftp/private -s /sbin/nologin ftp_user
Configure user data
# vi/etc/pam.d/vsftpd
// will auth and account All configuration lines are commented out and the following is added:
authrequiredpam_userdb.so db=/etc/vsftpd/userlist
accountrequiredpam_userdb.so db=/etc/vsftpd/userlist
userlist is/etc vsftpd/userlist db database, but don't add. db suffixes, the system automatically added
In/etc vsftpd/vsftpd conf add 1 under content:
#vim /etc/vsftpd/vsftpd.conf
#anon_root=/ftp/open // If you want to increase 1 Public file directory, comment out virtual_use_local_privs=YES
guest_enable=YES
guest_username=ftp_user
chroot_local_user=YES
allow_writeable_chroot=YES
At the same time will
chroot_list_enable=YES,chroot_list_file=/etc/vsftpd/chroot_list
Comment out and remove
chroot_list_file=/etc/vsftpd/chroot_list
Instead of
chroot_list_file=/ftp
chroot_list_enable=YES
# (default follows)
chroot_list_file=/ftp
Start the vsftpd
#systemctl start vsftpd
Set to boot
#rpm -qc vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
0
Check the vsftpd status
#rpm -qc vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
1
The local login
#rpm -qc vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
2
Others, if you cannot create a file, modify a file, etc., change the relevant directory permissions yourself.
conclusion