小孩子Wiki >>所属分类 >> 技巧命令   

SELinux阻止vsftp用户访问主目录

标签: selinux vsftp linux

顶[0] 发表评论(0) 编辑词条

当出现SELinux阻止vsftp服务器,一是把selinux关闭,二是给vsftp服务加上selinux的开放策略

目录

selinux关闭方法:编辑本段回目录

在/etc/selinux/config 配置文件如下;
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=Disabled  #这样就把SELINUX服务器关掉了,请重新启动系统;
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

selinux的开放策略:编辑本段回目录

CentOS 5下SELinux阻止vsftp用户访问主目录

在CentOS 5的安装过程中,如果启用了SELinux,则本地用户通过ftp访问服务器时,将会发生如下错误:


500 OOPS: cannot change directory:/home/***
Login failed.

在系统日志中也可以看到如下信息:

[root@web ~]# tail /var/log/messages
Sep  5 08:30:59 web setroubleshoot: SELinux is preventing the ftp daemon from reading users home directories (./home). For complete SELinux messages. run sealert -l 81cf3268-4d97-449a-9949-3a08ceef49b6

按照其中所述,运行

[root@web ~]# sealert -l 81cf3268-4d97-449a-9949-3a08ceef49b6

Summary:
SELinux is preventing the ftp daemon from reading users home directories (./home).

Detailed Description:
SELinux has denied the ftp daemon access to users home directories (./home). Someone is attempting to login via your ftp daemon to a user account. If you only setup ftp to allow anonymous ftp, this could signal a intrusion attempt.

Allowing Access:
If you want ftp to allow users access to their home directories you need to turn on the ftp_home_dir boolean: "setsebool -P ftp_home_dir=1"

The following command will allow this access:
setsebool -P ftp_home_dir=1

按照其中描述,执行该命令:

[root@web ~]# setsebool -P ftp_home_dir=1

之后本地用户就可以用FTP登录该服务器了。

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

如果不想用上面的方法,可以参考下面的方法:

1、关闭selinux,重启服务器,这样就可以不用通过selinux的验证了。

2、在cu找到的解决方法:

最重要的是man ftpd_selinux,解决这个问题只要:
1. setsebool -P ftpd_disable_trans 1
2. service vsftpd restart

附件列表


→如果您认为本词条还有待完善,请 编辑词条

上一篇解决linux 中文显示乱码

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
0

收藏到:  

词条信息

小新
小新
超级管理员
最近编辑者 发短消息   

相关词条