vsftpd如何使用户能访问ftp但不能远程登录

2023-04-12 02:51:00 访问 如何使用 远程登录

如何使用户能访问ftp但不能远程登录

首先,我们需要确定用户要访问的目录是否存在。假设用户要访问的目录是 /home/user1/ftp 。那么,我们可以在 /etc/vsftpd.conf 文件中添加如下内容:

local_root=/home/user1/ftp

然后,我们需要修改 /etc/vsftpd.conf 文件,找到如下行:

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

anonymous_enable=YES

将其改为:

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

anonymous_enable=NO

这样,用户就不能匿名访问FTP了。

接下来,我们需要配置用户的权限。找到 /etc/vsftpd.conf 文件中的如下行:

# Uncomment this to allow local users to log in.

local_enable=YES

将其改为:

# Uncomment this to allow local users to log in.

local_enable=NO

这样,用户就不能在本地登录了。

最后,重启vsftpd服务:

sudo service vsftpd restart

这样,用户就能访问ftp了,但是不能远程登录。

相关文章