[转]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。

http://hi.baidu.com/cwg3739/blog/item/3d02a477fc42411fb051b981.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 这个错误提示说明用户在连接vsftpd时无法更改到指定的目录/home/。这可能是由于以下原因之一导致的: 1. 目录不存在:请确认目录/home/是否存在。如果不存在,请创建该目录并确保它可以被FTP用户访问。您可以使用以下命令创建该目录: ``` sudo mkdir /home ``` 2. 权限问题:请确保FTP用户具有访问目录的权限。您可以使用以下命令更改目录的权限: ``` sudo chmod 755 /home ``` 3. SELinux或AppArmor:如果您的系统上启用了SELinux或AppArmor,它们可能会阻止FTP用户访问/home目录。您可以尝试禁用SELinux或AppArmor来解决此问题。 对于SELinux,您可以使用以下命令禁用它: ``` sudo setenforce 0 ``` 对于AppArmor,您可以使用以下命令禁用它: ``` sudo systemctl stop apparmor ``` 请注意,在禁用SELinux或AppArmor之前,请确保您已经了解了其安全影响,并在必要时采取适当的措施。 ### 回答2: 这个错误是由于vsftpd服务器无法切换到指定目录"/home/"所导致的。原因可能有以下几点: 1. 目录不存在:请确保"/home/"目录确实存在于系统中。可以通过在终端中运行命令`ls /home/`来检查目录是否存在。 2. 权限问题:vsftpd服务器可能没有足够的权限来访问"/home/"目录。这可能是由于目录的权限设置不正确造成的。可以通过运行命令`ls -l /home/`来检查目录的权限设置。确保vsftpd服务器有足够的权限来访问该目录。 3. SELinux限制:如果您的系统启用了SELinux安全机制,并且SELinux策略不允许vsftpd服务器访问"/home/"目录,那么也会导致此错误。您可以通过禁用SELinux或者调整SELinux策略来解决此问题。 4. vsftpd配置错误:请确保vsftpd服务器的配置文件正确设置了"/home/"作为默认目录。您可以编辑vsftpd的配置文件(通常位于/etc/vsftpd.conf),将"local_root=/home/"添加或修改为正确的路径。 无论哪种情况,都建议检查系统日志以查看更详细的错误信息。通常,vsftpd服务器的错误日志位于"/var/log/vsftpd.log"。您可以使用命令`tail -f /var/log/vsftpd.log`来监视日志文件的实时更新,并获取更多关于错误发生的详细信息。 总之,要解决vsftpd服务器报错"500 OOPS: cannot change directory:/home/",您需要确保目录存在、权限设置正确、SELinux策略允许访问,并检查vsftpd的配置文件中的默认目录设置。 ### 回答3: 当出现"vsftpd 500 OOPS: cannot change directory:/home/"错误时,这通常意味着FTP用户的目录设置有问题。 vsftpd 是一款高度可靠且安全的FTP服务器软件,可在Linux系统中使用。错误信息中的"/home/"是指FTP用户的默认根目录。出现问题的原因有以下几种可能性: 1. 权限设置不正确:确保FTP用户(如vsftpd)具有适当的权限来访问"/home/"目录。可以通过使用chown和chmod命令进行设置。例如,确保FTP用户(vsftpd)是目录的所有者,并具有适当的访问权限。 2. SELinux或AppArmor问题:某些Linux发行版可能使用SELinux或AppArmor等安全模块,这些模块可以限制FTP服务器访问用户的目录。需要检查SELinux或AppArmor配置,确保FTP用户被允许访问"/home/"目录。 3. 目录不存在:确保"/home/"目录实际存在,并且拥有适当的权限。 4. 软件配置错误:检查vsftpd的配置文件,通常位于"/etc/vsftpd.conf"。确保配置文件正确设置了FTP用户的根目录,并且没有其他配置错误导致无法访问目录。 综上所述,当出现"vsftpd 500 OOPS: cannot change directory:/home/"错误时,需要检查并修复上述可能导致问题的原因。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值