如何使用 vsftpd 创建 FTP 受限用户?(通过 Ubuntu 中的终端)

如何使用 vsftpd 创建 FTP 受限用户?(通过 Ubuntu 中的终端)

我已经安装了带有 vsftpd 的 ubuntu 12.04。我需要创建只能访问 /var/www/nameDirectory 等目录的 FTP 用户。我以为这是一个非常基本的功能,但在 vsftpd.conf 中似乎没有我尝试使用的功能

chroot_local_user=YES

但是(使用 adduser 创建用户“test”)“test”仍然能够浏览文件系统。我设法将“test”的根目录(使用 usermod)更改为 /var/www/nameDirectory,但他仍然能够返回到 /var 或 /。

然后我尝试

chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

创建列表文件并将“测试”放入其中。同样没有运气。

最后我甚至试图遵循这一点https://askubuntu.com/questions/575523/how-to-setup-virtual-users-for-vsftpd-with-access-to-a-specific-sub-directory 但没有用。

我失去了一些东西。

问题是,在 FileZilla 中,我可以使用用户“test”访问,进入正确的目录,但有权浏览所有内容。

这是我的 vsftpd.conf

listen=YES
anonymous_enable=YES
local_enable=YES
write_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
secure_chroot_dir=/var/run/vsftpd/empty
rsa_cert_file=/etc/ssl/private/vsftpd.pem

编辑:为了玩一玩,我尝试在 /etc/vsftpd.conf 中将 local_enable 设置为 NO 或将 write_enable 设置为 NO,但没有效果(仍然能够通过 FTP 访问,仍然能够以用户“test”的身份写入)。也许是配置文件错误?或者其他软件为我提供了 FTP 服务?我怎么知道发生了什么?

编辑 2:停止 vsftpd(服务 vsftpd 停止)并且仍然能够连接到 FTP。我如何知道是什么给了我 FTP 访问权限?

相关内容