翔子 发表于 2009-8-18 12:38:29

vsftp 限制用户目录,不得改变目录到上级

如何让特定使用者peter、john 不得变更目录
使用者的预设目录为/home/username,若是我们不希望使用者在ftp 时能够
切换到上一层目录/home,则可参考以下步骤。

Step1. 修改/etc/vsftpd/vsftpd.conf
将这两行
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
注释去掉
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

Step2. 新增一个文件: /etc/vsftpd/chroot_list
内容写需要限制的用户名:
peter
john

Step3. 重新启动vsftpd
# /sbin/service vsftpd restart
Shutting down vsftpd: OK ]
Starting vsftpd for vsftpd: OK ]

若是peter 欲切换到根目录以外的目录,则会出现以下警告:
ftp> cd /home
550 Failed to change directory.
页: [1]
查看完整版本: vsftp 限制用户目录,不得改变目录到上级