连接 FTP 服务器提示“500 OOPS: cannot change directory:/home/xxx”

  • Post author:
  • Post category:其他




今天在 CentOS 上测试 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 客户端的包,安装上就好了。