CentOS提示“500 OOPS: cannot change
在CentOS 上完成VSFTP安裝之後,測試 FTP 伺服器驗證登入,提示“500 OOPS: cannot change directory:/home/xxx”,不能切換到使用者宿主目錄?一看到與宿主目錄有關,第一反應就是會不會又跟 SELinux 中的策略有關,因為之前測試 Samba 實現“允許使用者通過 Windows 用戶端訪問自己的宿主目錄”,就需要先執行 setsebool -P samba_enable_home_dirs on,而且用 getsebool -a | grep ftp 也看到了一個“ftp_home_dir –> off”。不過還是先百度了一下,繼而在終端下執行:
# 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 用戶端的包,安裝上就好了。