This article mainly introduces the detailed explanation of CentOS6.8 installation FTP and adding users. The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let’s follow the editor and take a look.
Install FTP
1 Check whether FTP has been installed
rpm -qa | grep vsftpd
2 If not, install it
yum install vsftpd
2 Set vsftpd to start at boot
chkconfig --level 35 vsftpd on
3 Configure the FTP server (turn on user-based Access control)
1 Modification of configuration file
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO # 是否开启匿名登录 local_enable=YES # 是否允许本地用户登录 write_enable=YES # 是否允许上传 local_umask=022 # 默认的umask码 diremssage_enable=YES # 是否显示目录说明文件 xferlog_enable=YES # 是否记录ftp传输过程 connect_from_prot_20=YES # 是否确定端口传输来自20 xferlog_ftd_format=YES # 是否使用标准的ftp xferlog模式 chroot_list_enable=YES # 是否将系统用户限制在自己的home目录下 chroot_list_file=/etc/vsftpd/chroot_list # 列表不受限制的用户 listen=YES # 是否开启监听 pam_service_name=vsftpd # 服务名称 userlist_enable=YES tcp_wrappers=YES
2 Modification of selinux
getsebool -a | grep ftp
If an error is reported, getsebool: SELinux is disabled. Then
vim /etc/selinux/config
modify SELINUX=1.
Then restart LINUX, "shutdown -r now" to restart immediately (for root user).
Re-execute "getsebool -a | grep ftp".
Modify selinux to allow users to write data in the home directory
setsebool -P allow_ftpd_anon_write off setsebool -P ftp_home_dir on
4 Create a virtual user
1 Create a user, and then modify the user’s login shell For nologin, users cannot log in to the system and can only use services within ftp
useradd -d /home/www/test -g ftp -s /sbin/nologin test # 指定用户 test 属于组 ftp,只能访问的目录是 /home/www/test,不能登陆系统 passwd test # 设置该用户的密码
2 Add user test to chroot_list
vim /etc/vsftpd/chroot_list # 把 test 加入该文件
Five test virtual users
Enter "ftp://yourip" 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.
Six other configurations
Open the configuration file vsftpd.conf
max_client=100 # vsftpd最大支持链接数100个IP max_per=5 # 每个IP能支持5个链接 local_max_rate=81920 # 限制传输速度 listen_address=某个IP # 绑定某个IP到vsftpd,只允许该IP访问 xferlog_file=/var/log/vsftpd.log # 日志存放位置
[Related recommendations]
2. Introduction to TOMCAT cluster under NGINX reverse proxy
3. Introduction to Linux backup and recovery and file permissions
4. Detailed explanation of how to manually add a network bridge with Docker
5. How to install a VMWare virtual machine in linux
The above is the detailed content of Example tutorial on installing FTP and adding users under Linux. For more information, please follow other related articles on the PHP Chinese website!