问题现象
现场通过 ftp 获取数据文件,报错信息如下:
$ wget 'ftp://etla:Etla%402016%21@172.16.102.76//home/etla/gbase_dispatc
h/dispcli862b20r7/my.data'
--2017-11-08 15:58:03-- ftp://etla:*password*@172.16.102.76//home/etla/gbase
_dispatch/dispcli862b20r7/my.data => “my.data”
Connecting to 172.16.102.76:21
... connected.
Logging in as etla ...
Login incorrect.
500 OOPS: cannot change directory:/home/*******
500 OOPS: child died
解决方法
当你看到以上提示时,试着输入以下命令解决:
#setsebool -P ftpd_disable_trans 1
#service vsftpd restart
说明
第一行中的-P 参数是为了以后不需要每次开机都输入这个命令。
如果使用 setsebool -P ftpd_disable_trans 1 //加-P 表示永久性。
如果提示以下错误:
# setsebool -P ftpd_disable_trans 1
libsemanage.dbase_llist_set: record not found in the database (No such file o
r directory).
libsemanage.dbase_llist_set: could not set record value (No such file or direc
tory).
Could not change boolean ftpd_disable_trans
Could not change policy booleans
可能直接使用下面这个一条就可以解决了:
# /usr/sbin/setsebool -P ftp_home_dir 1
如果还是不行的话再使用下面完全方式:
# setsebool allow_ftpd_full_access 1
# setsebool allow_ftpd_use_cifs 1
# setsebool allow_ftpd_use_nfs 1
# setsebool -P ftp_home_dir 1
# setsebool httpd_enable_ftp_server 1
# setsebool tftp_anon_write 1
# service vsftpd restart
关闭 vsftpd:[确定]
为 vsftpd 启动 vsftpd:[确定]
# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> on
allow_ftpd_use_cifs --> on
allow_ftpd_use_nfs --> on
ftp_home_dir --> on
ftpd_connect_db --> off
httpd_enable_ftp_server --> on
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> on
重启 vsftpd,即可解决问题。