zoukankan      html  css  js  c++  java
  • Linux启用ftp服务及连接

    虚拟机的系统是centos6.3

    第一步.启动ftp

    service vsftpd restart

    提示 vsftpd: 未被识别的服务

    解决方法是升级vsftpd服务

    yum install vsftpd

    再步重启该服务成功.

     netstat -an | grep 21

    发现21端口确实处于LISTEN监听状态

     

    第二步.

    虚拟机使用命令

    tcpdump -i eth0 -nnX port 21

    用于抓取第一块网卡ip的21端口数据包,以十六进制显示

    在真实机的命令行下使用命令(192.168.2.102为虚拟机的IP)

    ftp 192.168.2.102

    尝试与虚拟机建立ftp连接

    发现虽然虚拟机中能抓到包,但真实机并没有提示输入用户名和密码,即未成功连接

    第三步.发现是iptables防火墙的问题.

    servcie iptables stop

    用于临时关闭防火墙

    chkconfig iptables off

    用于永久关闭防火墙

    第四步.执行第二步中的命令,需要输入用户名和密码了.

    但是之后立即提示

    500 OOPS: cannot change directory:/home/user1
    500 OOPS: child died
    远程主机关闭连接。

    排查下列可能

    1. Does the directory for the user you are trying to login as even exist?
    2. Check file permissions for the directory being accessed to ensure that the directory can be read, but also has execute permissions.
    3. Check SELINUX. Might need to disable to get VSTFTPD to work. Not an ideal situation if you need SELINUX active, but at least you will know what the cause of your error is.

    发现是SeLinux安全模块的问题.

    与SELinux有关的命令及文件:

    查看SELinux状态:

    1、/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态

    SELinux status:                 enabled

    2、getenforce                 ##也可以用这个命令检查

    关闭SELinux:

    1、临时关闭(不用重启机器):

    setenforce 0                  ##设置SELinux 成为permissive模式

                                  ##setenforce 1 设置SELinux 成为enforcing模式

    2、修改配置文件需要重启机器:

    修改/etc/selinux/config 文件

    将SELINUX=enforcing改为SELINUX=disabled

    重启机器即可

    第五步.输入成功,登录成功

     

  • 相关阅读:
    【题解】[Codeforces 1221D] Make The Fence Great Again【DP】
    PAM / 回文自动机(回文树)略解
    【AGC048F】【2020六校联考WC #9】序列【构造】【DP】
    json解析:[2]fastjson 使用
    JAVA获取时间戳,哪个更快
    Android拍照、录像、录音代码范例
    取消GridView/ListView item被点击时的效果
    Android中使用speex将PCM录音格式转Wav格式
    【Android】【录音】Android录音--AudioRecord、MediaRecorder
    Android软键盘遮挡的四种解决方案
  • 原文地址:https://www.cnblogs.com/wincent98/p/7375554.html
Copyright © 2011-2022 走看看