参考 http://hi.baidu.com/jenrald/item/b8921b82b5ade72a100ef3c0
一 前言
用ftp命令连接 ftp服务器时提示:
“500 OOPS: cannot change directory:/home/xxx”
二解决方案
百度,经证实有效解决方案是 # setsebool ftp_home_dir on
现将参考网页内容摘抄如下:
# setsebool ftpd_disable_trans 1
# service vsftpd restart
结果刚执行完第一条就提示“Could not change active booleans: Invalid boolean”,又是没见过的提示,baidu~,果然与那个“ftp_home_dir”有关,执行:
# setsebool ftp_home_dir on(注:在服务 running 状态下执行时间会比较久)
then~
# ftp 192.168.2.2
Connected to 192.168.2.2 (192.168.2.2).
220 (vsFTPd 2.2.2)
Name (192.168.2.2:root): azune
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,2,2,54,76).
150 Here comes the directory listing.
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Desktop
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Documents
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Downloads
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Music
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Pictures
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Public
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Templates
drwxr-xr-x 2 500 500 4096 Sep 18 10:27 Videos
226 Directory send OK.
ftp> exit
221 Goodbye.
至于 ftp 登录时提示“-bash: ftp: command not found”的话,是缺少 ftp 客户端的包,安装上就好了。