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

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

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值