在CentOS中,使用vsftpd(Very Secure FTP Daemon)可以限制用户访问
sudo yum install vsftpd
/etc/vsftpd/vsftpd.conf
:sudo vi /etc/vsftpd/vsftpd.conf
找到以下设置并进行修改:
anonymous_enable=YES
更改为anonymous_enable=NO
,以禁止匿名访问。local_enable=YES
取消注释(删除行首的#
),以允许本地用户访问。write_enable=YES
取消注释(删除行首的#
),以允许用户上传文件。chroot_local_user=YES
取消注释(删除行首的#
),以限制用户访问其主目录。ftpusers
,并将需要限制访问的用户添加到该组中。然后,在vsftpd.conf
文件中添加以下设置:userlist_enable=YES
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO
/etc/vsftpd/user_list
文件中添加需要限制访问的用户。sudo systemctl restart vsftpd
现在,vsftpd应该已限制访问,只允许本地用户访问,并根据需要进行其他限制。