问题原文
原帖链接 · zigojacko · CC BY-SA 3.0
I need to periodically give temporary and limited access to various directories on a CentOS linux server that has vsftp installed.
I've created a user using useradd [user_name] and given them a password using passwd [password].
I've created a directory in /var/ftp and then I bind this to the directory that I wish to limit access to.
What else do I need to specifically do to ensure that when this user logs into FTP, they only have access to this directory please?
已采纳解答
原帖链接 · zigojacko · CC BY-SA 3.0
Complete answer that solved my question for any others that are after a step by step walkthrough...
Install vsftpd using this as a guide.
- Create user with
useradd [user_name]. - Create user's password with
passwd [user_name]. (You'll be prompted to specify the password). - Create FTP directory in
/var/ftpand then bind to the 'home' directory you wish to specify for this user withmount --bind /var/www/vhosts/domain.com/ /var/ftp/custom_name/. Change user's home directory with
usermod -d /var/ftp/custom_name/ user_nameIn
/etc/vsftpd/vsftpd.conf, ensure all all of the following are set:-- chroot_local_user=YES
- chroot_list_enable=YES
- chroot_list_file=/etc/vsftpd.chroot_list
Only list users in the vsftpd.chroot_list file if you want them to have full access to anywhere on the server. By not listing them in this file, you're saying restrict all vsftpd users to their specified home directory.
In other words (for reference):-
- means that by default, ALL users get chrooted except users in the file...
- chroot_local_user=YES
- chroot_list_enable=YES
- means that by default, ONLY users in the file get chrooted...
- chroot_local_user=NO
- chroot_list_enable=YES
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
