UBUNTU:用户登录时 ftp 服务器无法更改目录

UBUNTU:用户登录时 ftp 服务器无法更改目录

我已经为一个客户端用户 (ftuser) 设置了一个 FTP 服务器 (vsftpd)。此用户应该有权访问文件夹 /srv/webroot/user。文件夹 /srv 及其所有子文件夹均归我所有。我与 ftpuser 不在同一组中。现在我尝试通过以下方式实现用户的权限:

chmod 770 -R /srv
chmod 777 -R /srv/webroot/user

但是当用户尝试通过 ftp 登录时,FTP 服务器会显示:

500 OOPS: cannot change directory: /srv/webroot/user

我只是尝试了一下,通过以下方式授予用户对整个文件夹结构的权限:

chmod 777 -R /srv

现在他不仅可以登录,还可以访问根文件夹(/)和所有其他子文件夹(即/etc,/home,...)。

我必须如何设置权限以便我的用户能够登录并且只能访问 /srv/webroot/user?

答案1

如果您希望用户只能看到自己的文件,则必须在 vsftpd.conf 中设置“chroot”相关选项。使用“chmod”和“chown”限制 ftp 用户的访问权限是一种不好的方法。用户必须能够在其 ftp-root 目录中写入才能登录。

答案2

为了允许用户更改到特定目录cd,用户应该具有权限x(数字中的位 1)。如果您不想向所有人授予此权限,则需要为组g+x或用户授予此u+x权限。当然,您还需要设置正确的所有权。

答案3

heinob - /etc/vsftpd.conf 中有如下部分

# You may specify an explicit list of local users to chroot() to their home directory. If chroot_local_user is YES, then this list becomes a list of users to NOT chroot().(Warning! chroot'ing can be very dangerous. If using chroot, make sure that the user does not have write access to the top level directory within the chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list

您确定chroot_local_user=YES没有取消注释吗?

相关内容