错误消息“500 OOPS:vsftpd:拒绝在chroot()内部使用可写根运行” – 保持用户被监禁

到目前为止,我一直无法让FTP用户被监禁到他们的网站目录。 有没有一个解决方案,既修复了这个错误,又让用户被监禁到他们的目录?

我改变了我的vsFTPd设置:

listen_port=9000 Set: anonymous_enable=NO Uncomment: local_enable=YES Uncomment: write_enable=YES Uncomment: local_umask=022 Set: connect_from_port_20=NO Uncomment: idle_session_timeout=600 Uncomment: data_connection_timeout=120 Comment out: #ftpd_banner=Welcome to blah FTP service. [should be on line 104] Added: banner_file=/etc/issue.net Uncomment: chroot_local_user=YES Uncomment: chroot_local_user=YES Uncomment: chroot_list_enable=YES Uncomment : chroot_list_file=/etc/vsftpd.chroot_list 

在文件的末尾我添加了:

 # Show hidden files and the "." and ".." folders. # Useful to not write over hidden files: force_dot_files=YES # Hide the info about the owner (user and group) of the files. hide_ids=YES # Connection limit for each IP address: max_per_ip=10 # Maximum number of clients: max_clients=5 # FTP Passive Settings pasv_enable=YES #If your listen_port is 9000 set this range to 7500 and 8500 pasv_min_port=[port range min] pasv_max_port=[port range max] 

有问题的用户mybloguser被监禁在/srv/www/myblog下的她/他的网站目录中,并且该用户不是nano /etc/vsftpd.chroot_list文件的一部分。 用户的主目录也是/srv/www/myblog过去曾经用过的。

我尝试了allow_writeable_chroot=YES解决方案,并且实际上完全打破了vsFTPd。

我试过了:

  • 修复500 OOPS:vsftpd:拒绝在chroot()内部使用可写根运行

  • 更新后vsFTPd停止工作

  • 更新后vsFTPd停止工作

  • 修复500 OOPS:vsftpd:拒绝在vsftpd上的chroot()内运行可写根

我们如何修复此错误并使用户被监禁到其主目录?

对于VSFTPD 3,

  1. 请访问: /etc/vsftpd.conf
  2. 并添加这个:

     allow_writeable_chroot=YES 

    如果它还不存在,只需添加即可。

  3. 重启vsftpd服务:

     service vsftpd restart 

它应该工作。

这个问题的真正解决方案是:用户的主文件夹 应该可读的。

因此,如果用户站点在文件夹中是cat/example.com/http/ ,则文件夹cat必须具有chmod 555并且一切都会正常。

在对此帖进行进一步审核之后,在评论中发布了一个修复我的问题的软件包。 您可以使用我的名字或“标记”文档进行搜索: http : //www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/ 。 以下是我如何进一步修复此问题的详细信息。

用户仍然被囚禁给他们的家庭主任!

 # ------------------------------------------------------------------------------ # SETUP FTP USERS -------------------------------------------------------------- # ------------------------------------------------------------------------------ # create the ftp users and lock them to the website directories useradd -d /srv/www/[website/appname] -m [ftp user name] # set the ftp account passwords passwd [ftp user name] # add the ftp users to the www-data user/group adduser [ftp user name] www-data # BUG FIX: 500 OOPS: vsftpd: refusing to run with writable root inside chroot() sudo add-apt-repository ppa:thefrontiergroup/vsftpd sudo apt-get update sudo apt-get install vsftpd # Edit the vsftpd.conf and append this setting to the end of the file to keep users' jailed! nano /etc/vsftpd.conf # add all of the text between the starting [[ and ending ]] # [[ # Keep non-chroot listed users jailed allow_writeable_chroot=YES # ]] # restart the service for changes to take effect sudo service vsftpd restart #test ftp via secondary terminal window: ftp [ftp user name]@[server ipaddress] [ftp port] 

根据前面的回答“这个问题的真实解决方案:用户的主文件夹不应该只能被写入。”。 一般的想法是正确的,但却有错误的认识。

下面我将尝试举一个简单的例子:

首先,我们需要构建用户目录的拓扑:

  / home(ro)
    | -someuser(rw​​,700)
          | -ftp_upload(ro,555) -  ch_rooting here,vsftpd所需的只读:(
            | -temp(rw,755)
            | -in_box(rw,755)
            | -out_box(rw,755)

vsftpd.conf剪切:

 #启用chrooting
 chroot_local_user = YES

 #chroot所有用户,除了在chroot_list中收听
 chroot_list_enable = YES

 #例外列表。 理想情况下,它应该是空白的;)
 chroot_list_file =的/ etc / VSFTPD / chroot_list

 #将ftp根目录映射到特定目录
 local_root = /家庭/ SomeUser的/ FTP

此配置适用于单用户配置。 对于多用户,应另外使用“user_config_dir”指令。

**更新20/09

—— **

这是一个棘手的解决方法,不是最好的想法,但….如果你需要可写的ftp根文件夹,只需在启动前和启动后命令中插入权限更改命令。

  1. 预启动 – 将权限更改为只读,服务器需要(:

  2. 启动服务器

  3. 启动后 – 更改读写权限或您需要的权限。

我还需要将以下内容添加到/etc/vsftpd.conf文件中:

 seccomp_sandbox=NO 

而且不需要定制回购!!

并取消注释:

 write_enable=YES 

简单的解决方法是执行错误消息建议:使根不可写,然后如果需要启用上载,请创建一个具有写权限的子目录。 无需更改配置。

经过3个小时的谷歌搜索,我得到了Ubuntu 14.04.2 LTS VSFTPd 3的工作。 一旦使用客户端访问,主文件夹将可见/ home / vimal。 我已使用root权限登录vimal。 我创建了ftpShare文件夹,但没有多大意义。

 sudo chown vimal:vimal /home/vimal/ftpShare/ 

一些有用的命令:

 sudo nano /etc/vsftpd.conf sudo service vsftpd restart sudo apt-get purge vsftpd netstat -a | grep ftp tcp 0 0 *:ftp *:* LISTEN ftp://12.345.23.xxx/ for browser login 

以上意味着ftp守护程序正在运行

我有以下配置:

 seccomp_sandbox=no listen=YES anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 dirmessage_enable=YES use_localtime=YES xferlog_enable=YES connect_from_port_20=YES chroot_local_user=YES chroot_list_enable=NO secure_chroot_dir=/var/run/vsftpd/empty rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key allow_writeable_chroot=YES 

一旦FTP工作,你可以进一步调整它以满足特定需求,上面的一些有默认值,但我不记得确切。

FTP客户端中出现的错误:

1. 500 OOPS:prctl PR_SET_SECCOMP失败

解。

 seccomp_sandbox=no 

[在第一行vsftpd.conf上添加它,在初始注释部分结束后]

2. 500 OOPS:vsftpd:拒绝在chroot()中使用可写根运行

 allow_writeable_chroot=YES 

我在最后一行添加了它。

这几乎是toastboy70所提到的。 将ftp-root目录设为ftp.ftp并且不可写(/etc/vsftpd.conf):anon_root = / srv / ftp

然后创建一个可写的子目录:/ srv / ftp / upload

我解决了vsFTPd拒绝在我的Ubuntu服务器上的chroot()内运行可写根的问题,如下所示:

我刚刚在vsftpd.conf文件中添加了以下行:

 allow_writeable_chroot=YES