CentOS 6.8 Install FTP and add users
- 2020-06-03 09:07:10
- OfStack
1 installation FTP
1 Check whether FTP has been installed
rpm -qa | grep vsftpd
2 If not, then install
yum install vsftpd
2. Set vsftpd to boot
chkconfig --level 35 vsftpd on
3 Configure FTP server (enable user-based access control)
1 Configuration file modification
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO # Whether anonymous login is enabled
local_enable=YES # Whether to allow local users to log in
write_enable=YES # Whether uploading is allowed
local_umask=022 # The default umask code
diremssage_enable=YES # Whether to display a directory description file
xferlog_enable=YES # Should record ftp Transfer process
connect_from_prot_20=YES # Whether to determine whether the port transfer is coming from 20
xferlog_ftd_format=YES # Whether to use standard ftp xferlog model
chroot_list_enable=YES # Whether to restrict system users to your own home directory
chroot_list_file=/etc/vsftpd/chroot_list # List of unrestricted users
listen=YES # Whether listening is on or not
pam_service_name=vsftpd # The service name
userlist_enable=YES
tcp_wrappers=YES
2 modify selinux
getsebool -a | grep ftp
In case of error, getsebool: SELinux is disabled. the
vim /etc/selinux/config
Modify SELINUX = 1.
Then restart LINUX, "ES37en-ES38en now" immediately restart (root users).
Re-execute "getsebool-a | grep ftp".
Modify selinux to allow users to write data in their home directory
setsebool -P allow_ftpd_anon_write off
setsebool -P ftp_home_dir on
Create virtual users
1 create a user, then change the user's login shell to nologin, so that the user cannot log in to the system and can only use services within ftp
useradd -d /home/www/test -g ftp -s /sbin/nologin test # Specify a user test Belong to the group ftp , can only access the directory is /home/www/test Cannot log in to the system
passwd test # Set the user's password
Add user test to chroot_list
vim /etc/vsftpd/chroot_list # the test Add the file
Test the virtual user
Enter "ftp:// Your ip" in the address bar of the browser. Enter the account number and password in the pop-up dialog box, and the connection will be successful.
6 Other configurations
Open the configuration file vsftpd.conf
yum install vsftpd
0