zoukankan      html  css  js  c++  java
  • 500 OOPS: vsftpd: refusing to run with writable root inside chroot()解决方法

    # setsebool -P ftpd_full_access=on

    FTP连接时报错如下:

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

    解决方法:

    chroot_local_user=YES ---锁定用户登录ftp后,只能到自己的家目录下,不能随便切换到其它目录。但是普通系统用户默认是可以在自己的家目录里写文件的,vsftp出于安全性要求,
    如果锁定了用户的ftp登录目录,则所在目录不能有写权限。

    方法1、 /etc/vsftpd/vsftpd.conf配置文件增加如下一行

    local_root=/data/ftp  //系统用户登录后进入到该目录注意该目录对其它用户同样不能有写的权限。(连写入的权限都没有,这个方法也不靠谱)

    如果有写权限,则执行chroot a-w /var/ftp -R 取消写入权限。

    方法2、简单粗暴的方法

    不要设置local_root参数,取消用户往自己目录写权限: chmod a-w /home/username,但是用户登录操作系统后会影响用户使用,自己目录写的权限都没有。--不可行。

    方法3、/etc/vsftpd/vsftpd.conf配置文件增加如下一行

    allow_writeable_chroot=YES   --可行。ftp目录必须要有写权限。

    方法4、添加例外

    /etc/vsftpd/chroot_list 这个配置文件中加入用户名

    修改完配置文件事要重启vsftpd服务。

    ==============

    听起来有点绕,按下面的配置就没问题了:

    #chmod o-w /data/ftp

    vi /etc/vsftpd/vsftpd.conf 修改下面三行。

    chroot_local_user=YES --锁定ftp用户目录。不能随便切换到其它目录。
    local_root=/data/ftp ---指定用户登录后的目录。或者不指定也行,系统用户登录ftp后,直接到用户自己的家目录。
    allow_writeable_chroot=yes
    如果要添加例外,即允许某个用户可以切换到其它目录,则添加下面两行参数,否则可以不用配置。
    chroot_list_enable= YES --这个是启用用户列表,对应下一句的chroot_list文件。 chroot_list_file=/etc/vsftpd/chrot_list ---在这个文件中的用户则不受限制,可以切换到其它目录。这个文件需要手动创建。

    这样,FTP用户登录后,只能在指定目录下进行读写操作,不能随便切换到其它目录。

    ============

     参考:


    The problem is that your users root directory is writable, which isn’t allowed when using chroot restrictions in the new update.

    To fix this you must either remove write permissions on the users root directory with the following command, replacing the directory with your users root:

    chmod a-w /home/user

    Or you can work around this security check by adding either of the two below into your configuration file.

    For the standard vsFTPd build (vsftpd):

    allow_writeable_chroot=YES

    For the extended vsFTPd build (vsftpd-ext):

    allow_writable_chroot=YES

    Removing the write permission on the root isn’t a perfect solution as doing this can cause a few problems with things that need to write to the root directory, such as the bash history file or some graphical environments.

    https://www.garron.me/en/bits/500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot-solved.html

    http://www.liquidweb.com/kb/error-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot-solved/

    =========================

    另外一种可行的配置方法:

    (这个方法总比你让所有用户都有写入权限o+w要安全得多)

    配置如下:

    chroot_local_user=YES
    local_root=/data/ftp
    chroot_list_enable=YES
    chroot_list_file=/etc/vsftpd/chroot_list 

    使用root 帐号执行如下命令:

    # setfacl -m u:用户名:rwx  /data/ftp   ---使用该命令来设置指定用户的acl权限,允许指定的用户可写,其它用户不可写。

     #chmod o-w /data/ftp  --取消对比所有用户可写。

    #systemctl restart vsftpd

  • 相关阅读:
    关于OC中.m文件下实现私有变量的方法,在.h文件下实现公有变量的方法
    mac中安装homebrew
    ios架构
    github命令记录
    Unity 游戏框架搭建 MonoBehaviour单例的模板
    Unity 游戏框架搭建 单例的模板
    unity 单列
    简单工厂与工厂
    NGUI动态播放视频
    在一个GameObject上进行多个AudioSource的控制
  • 原文地址:https://www.cnblogs.com/rusking/p/5970391.html
Copyright © 2011-2022 走看看