`
swvip
  • 浏览: 154520 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

[转]vsftpd出现500 OOPS: cannot change directory的解决办法

阅读更多
ftp服务器连接失败,错误提示:
500 OOPS: cannot change directory:/home/*******
500 OOPS: child died


解决方法:

1 在终端输入命令:
setsebool ftpd_disable_trans 1
service vsftpd restart

就OK了!但是下次重启了还会这样··

2 在终端输入命令:

setsebool -P ftpd_disable_trans 1

service vsftpd restart

这样每次重启机器都可以了·

原因就在SELinux。
===========================================================================================
另外一篇:


关于vsftpd 部分本地用户不能登录,部分可以”的问题,我重新做了一些实验,我把这个问题结合实验的结果再重新描述一下,请各位高人,帮忙看看可能的原因。 谢谢了!

系统中原来就有的本地帐号都不能登录,我的/etc/vsftpd/vsftpd.conf文件的配置如下:
local_enable=YES
write_enable=YES
chroot_local_user=YES
pam_service_name=vsftpd
/etc/pam.d/vsftpd存在且正常。

登录时错误信息都是一样的:
500 OOPS: cannot change directory:/home/xxxx
Login failed.
421 Service not available, remote server has closed connection

他们的home目录都是/home/xxxx。/home和/home/xxxx的权限都是755。
以上这些帐号都不能ftp登录,这些都是平常经常使用的,可以用shell登录的。

我新创建了一个usr1帐号,
# useradd -G test -d /tmp/usr1 usr1
能ftp登录,他的home为/tmp/usr1,在/分区上。而/home我是mount到/dev/hda9上的。
#mount
/dev/hdb1 on / type ext3 (rw)
/dev/hda9 on /home type ext2 (rw)

所以,我猜想:是否是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录呢?

为了验证以上设想,我试着再创建了一个帐号,
useradd -G test -d /home/usr3 usr3
/home, /home/usr3 的权限都是755。

usr3 ftp登录失败。
500 OOPS: cannot change directory:/home/usr3
Login failed.
421 Service not available, remote server has closed connection

至此,我觉得可以确定是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录。
参考文章:
-----------------------------------------------------------------------------------------
I finished my second upgrade to Fedora Core 4. Not everything is ironed out yet with the build of course. But one thing is for sure a lot has happened to the RedHat I knew before.

I must say of all the changes, for me the nicest addition is the new SELinux extensions. For deep background on the reasons for and theory of SELinux read, The Inevitability of Failure: The Flawed Assumption of Security in Modern Computing Environments

The more I work with SELinux the more I realize I need to know about it, and how exactly it does all its stuff. It certainly changes things relating to users, directories and access. As I am starting to learn it, I'm sure I'm doing things the hard-way. :)

The major difference, so far for me, in Red Hat's SELinux is the way ftp is handled. vsftpd is still the server which is great. However, it seems to be designed to run as a daemon rather than invoked via xinet.d. If you grab a working copy of the xinet.d file for vsftpd you can invoke it via xinet.d wrapper. I did my first server upgrade in this manner. The current one I am trying as a daemon. I certainly think I will miss some of the features that the xinet.d wrapper brings, and may yet return to it.

Of all the issues I saw most notable is if you want to enable chroot directory's outside of the normal /home/xxx vsftpd. These will fail with a

500 OOPS: cannot change directory: /mnt/xxxxx

I was able to use ftp if I logged in with an account with a directory in /home, but once I set a user account to have a home drive outside of /home (in this case on a mounted secondary disk) vsftpd barfs the above.


I found information at the NSA that indicates you can disable SELinux protection of the ftp daemon.

setsebool -P ftpd_disable_trans 1

This seems a bit drastic. It certainly works for now though.

I think ultimately the issue resides with policies, but as SELinux policies are new to me, it will take time before it all gets sorted out. As I spend time with the new SELinux extensions in Fedora Core 4 I will keep you updated on my thoughts and configuration lessons.


---------------------------------------------------------------------------------------

解决办法:
--------------------------------------------------------------------------------------
# setsebool ftpd_disable_trans 1
   # service vsftpd restart

 

 

 


所以,可以确定原因就在SELinux。

分享到:
评论

相关推荐

    vsftp登录报错”500OOPScannotchangedirectoryhome[借鉴].pdf

    vsftpd 登录报错“500 OOPS: cannot change directory:/home/*”处理方式 vsftpd 是一个基于 Linux 的 FTP 服务器软件,可以提供 FTP 服务,但有时候可能会出现登录报错的情况。下面是处理“500 OOPS: cannot ...

    新增加FTP用户方法

    如果在尝试登录FTP时遇到错误提示如“500 OOPS: cannot change directory: /home/*******”或“500 OOPS: child died”,可以尝试以下命令解决问题: ```bash setsebool -P ftpd_disable_trans=1 service vsftpd...

    C提高讲义.docx

    如果遇到"500 OOPS: cannot change directory"错误,可能是由于SELinux的限制。你可以运行`setsebool -P ftpd_disable_trans 1`来临时关闭这个限制,或者完全关闭SELinux。重启vsftpd服务以应用更改。 7. **设置...

    在linux下开启FTP服务方法介绍

    有时,您可能会遇到“500 OOPS: cannot change directory”的错误,这可能是由于SELinux的限制。解决这个问题,可以运行`setsebool ftpd_disable_trans 1`并重启FTP服务。如果您不熟悉SELinux,可以选择暂时关闭它。...

    VSFTP搭建服务

    - 如果遇到 “500 OOPS: cannot change directory” 错误,通常是由于权限设置不当或配置文件中的路径问题导致的。需要检查相关目录和文件的权限设置是否正确,以及配置文件中的路径是否准确无误。 #### 六、启动与...

    CentOS6.5安装ftp服务器

    例如,错误消息“500 OOPS: cannot change directory:/home/ftp”。为了解决这个问题,我们需要启用SELinux的FTP家庭目录功能: ```bash setsebool -P ftp_home_dir 1 ``` 最后,如果你的系统启用了防火墙,可能...

    CentOS 6.1 安装bugzilla

    - 如果遇到“500 OOPS: cannot change directory:/root”错误,可能是因为SELinux策略限制,使用以下命令解决: - `sestatus -b | grep ftp` - `setsebool -P ftpd_disable_trans on` - `setsebool -P ftp_home_...

    REDHAT Linux系统配置(整理版).docx

    - 如果遇到“500 OOPS: cannot change directory”错误,可能需要检查用户的家目录权限或设置。 4. **字符编码与RAW设备**: - 修改系统语言环境,如在`/etc/sysconfig/i18n`或相关文件中设置`LANG`变量为`zh_...

    CentOS安装bugzilla

    之后,需要编辑配置文件以启用root用户的FTP上传权限,并处理可能的SELinux限制,以避免“500 OOPS: cannot change directory:/root”错误。 **5. 安装Apache httpd** 在Bugzilla的安装目录下执行`yum install ...

Global site tag (gtag.js) - Google Analytics