SELinux与FTP

来源:互联网 发布:软件研发能力评估 编辑:程序博客网 时间:2024/06/09 16:35

系统环境:Red Hat Enterprise Linux Server 6

iptables的规则中已经对FTP服务放行了

 

windows客户端访问时的情况:

C:\Users\Administrator>ftp 192.168.18.140

Connected to 192.168.18.140.

220 (vsFTPd 2.2.2)

User (192.168.18.140:(none)): huage

331 Please specify the password.

Password:

500 OOPS: cannot change directory:/home/huage

500 OOPS: priv_sock_get_cmd

Connection closed by remote host.

 

出现这种情况是因为selinux的缘故:

[root@desktop huage]# sestatus

SELinux status:                 enabled

SELinuxfs mount:                /selinux

Current mode:                   enforcing

Mode from config file:          enforcing

Policy version:                 24

Policy from config file:        targeted

[root@desktop huage]# getsebool -a |grep ftp

allow_ftpd_anon_write --> off

allow_ftpd_full_access --> off

allow_ftpd_use_cifs --> off

allow_ftpd_use_nfs --> off

ftp_home_dir --> off

ftpd_connect_db --> off

httpd_enable_ftp_server --> off

sftpd_anon_write --> off

sftpd_enable_homedirs --> off

sftpd_full_access --> off

sftpd_write_ssh_home --> off

tftp_anon_write --> off

[root@desktop huage]# setsebool ftp_home_dir on                    //重启后失效

[root@desktop huage]# setsebool -P ftp_home_dir on               //永久保存

 

sestatus  This tool is used to get the status of system running SELinux.

getsebool:   

                get SELinux boolean value(s)

-a            Show all SELinux booleans.

 

setsebool

                set SELinux boolean value

用法:

       setsebool -P boolean value bool1=val1 bool2=val2 ...

If  the  -P option is given, all pending values are written to the policy file on disk. So they will be persistant

       across reboots. 

原创粉丝点击