Linux下yum 使用vsftp 快速 搭建ftp服务器 500错误

1.安装vsftp,我就不多说了,我用的是ubuntu,直接apt-get就完了

2.配置vsftpd.conf, vim /etc/vsftpd.conf

下面说说里面比较重要的选项

anonymous_enable=NO #不允许匿名用户
local_enable=YES #允许使用本地用户账号登陆
write_enable=YES #允许ftp用户写数据
connect_from_port_20=YES #通过20端口传输数据
chroot_local_user=YES #将用户锁定在自己的主目录,如 /home/ftpuser,这样ftpuser这个用户就不能访问除此目录之外的目录
chroot_list_enable=YES #启用不锁定用户在主目录的名单
chroot_list_file=/etc/vsftpd.chroot_list #当 chroot_list_enable 启用时,此列表生效,列表中的用户将不受锁定限制,格式为一行一个用户名

3.创建用户组合用户

useradd ftpuser -d /home/ftpuser -M -s /usr/sbin/nologin  
#创建一个ftpuser用户,目录为/home/ftpuser,-M为系统不创建home目录,因为之前已经指定并设为不可作为普通用户登录

4.启动vsftp

/etc/init.d/vsftpd start

5.设置密码

passwd ftpuser

6.使用filezilla或者直接在浏览器上输入你的ftp服务器ip,登录即可使用


当我们限定了用户不能跳出其主目录之后,使用该用户登录FTP时往往会遇到这个错误:

500?OOPS:?vsftpd:?refusing?to?run?with?writable?root?inside?chroot?()

解决方法,在配置文件中添加:

allow_writeable_chroot=YES

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注