• java 无法连接ftp服务器(500 OOPS: cannot change directory)


         在使用java连接ftp服务器时可能会出现无法连接的情况,检查代码是没有错误的,这时就应该考虑一下服务器端的情况了:

         首先用在本地打开命令窗口,输入:ftp ftp服务器IP,窗口会提示你输入用户名密码,如下图:

       

        正确输入用户名密码后,看窗口数否有下图所示情况:

       

        如出现上述情况,就说明服务器是不允许用户通过FTP登录到/home/*(*代表对应的用户)的目录下的

        解决过程:

       在终端下输入如下命令:

    [root@liangwode log]# sestatus -b| grep ftp
    allow_ftpd_anon_write                       off
    allow_ftpd_full_access                      off
    allow_ftpd_use_cifs                         off
    allow_ftpd_use_nfs                          off
    ftp_home_dir                                off
    ftpd_connect_db                             off
    ftpd_use_passive_mode                       off
    httpd_enable_ftp_server                     off
    tftp_anon_write                             off

     注意以上ftp_home_dir 是处于off的状态,也就是说当前是不允许用户通过FTP登录到/home/*(*代表对应的用户)的目录下的,为此,我们可以用以下方法解决

    [root@liangwode log]# setsebool ftp_home_dir on

     输入以上命令就是开启ftp_home_dir的功能,再次查看一下状态:

    [root@liangwode log]# sestatus -b| grep ftp
    allow_ftpd_anon_write                       off
    allow_ftpd_full_access                      off
    allow_ftpd_use_cifs                         off
    allow_ftpd_use_nfs                          off
    ftp_home_dir                                on
    ftpd_connect_db                             off
    ftpd_use_passive_mode                       off
    httpd_enable_ftp_server                     off
    tftp_anon_write                             off

     发现已经开启了,然后FTP客户端就可以正常登录了.问题解决。

    智者,寡言而多行
  • 相关阅读:
    还原 | revert (Cascading & Inheritance)
    过滤器 | filter (Filter Effects)
    过渡时间 | transition-duration (Animations & Transitions)
    过渡延时 | transition-delay (Animations & Transitions)
    过渡属性 | transition-property (Animations & Transitions)
    过渡定时功能 | transition-timing-function (Animations & Transitions)
    过渡 | transition (Animations & Transitions)
    ProxySQL 读写分离
    《抛弃learning rate decay吧!》
    《Tensorflow 中 learning rate decay 的奇技淫巧 》
  • 原文地址:https://www.cnblogs.com/angryprogrammer/p/3146236.html
Copyright © 2020-2023  润新知