这里不讲vsftpd的基本配置,网上教程已经太多了。这里只说seLinux的问题。
日前在CentOS6.5中安装了vsftpd,按照网上搜索的教程,配置好/etc/vsftpd/vsftpd.conf,重新启动后,登录实验,又出现了著名的不能设置主目录错误:
1
2
|
500
OOPS: cannot change directory:/home/*******
500
OOPS: child died
|
再到网上求助,发现多数都是让关掉seLinux服务,我记得以前也是这么做得,不过总觉得是有点因噎废食。于是继续google
终于看到了这篇文章,但是照做时却被提示错误:
1
2
|
#setsebool -P ftpd_disable_trans
1
Boolean ftpd_disable_trans is not defined
|
于是查询selinux
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root
@node4
home]#sestatus -b |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
ftpd_use_fusefs off
ftpd_use_passive_mode off
httpd_enable_ftp_server off
tftp_anon_write off
tftp_use_cifs off
tftp_use_nfs off
|
发现确实没有该项,但是却意外发现了ftp_home_dir,于是我照方抓药执行
1
|
setsebool -P ftp_home_dir
1
|
在查询一下,发现状态已经成功改过来了!
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root
@node4
home]#sestatus -b |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 on
ftpd_connect_db off
ftpd_use_fusefs off
ftpd_use_passive_mode off
httpd_enable_ftp_server off
tftp_anon_write off
tftp_use_cifs off
tftp_use_nfs off
|
重新启动vsftpd
1
|
#service vsftpd restart
|
再次连接vsftpd服务,成功了!
本文参考链接:https://www.cnblogs.com/xihong2014/p/6095115.html