• centos7 安装vsftpd的步骤


    感觉非常坑,依照网上说的没一个都測试了,可一直都报错。

    不断的又一次安装不下10次,最后一次最终測试出了正确的方法。

    #官网配置说明##

    https://security.appspot.com/vsftpd/vsftpd_conf.html


    ##需求##

    1)登录FTP 仅仅能看到当前用户的,不能跨越到主文件夹

    2)禁止匿名用户登录FTP

    3)改动FTP 监听port号!


    ##问题##

    yum install vsftpd

    结果一大堆问题。

    1)无法启动 systemctl stop vsftpd --> 成功过,第二行 systemctl start vsftpd ==> 一直报错一直报错

    [root@niche vsftpd]# whereis vsftpd
    vsftpd: /usr/sbin/vsftpd /etc/vsftpd /usr/share/man/man8/vsftpd.8.gz
    [root@niche vsftpd]# systemctl status vsftpd
    vsftpd.service - Vsftpd ftp daemon
       Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled)
       Active: failed (Result: exit-code) since Wed 2014-12-17 15:16:58 UTC; 18min a                                                              go
    
    Dec 17 15:16:58 niche systemd[1]: vsftpd.service: control process exited, c...=2
    Dec 17 15:16:58 niche systemd[1]: Failed to start Vsftpd ftp daemon.
    Dec 17 15:16:58 niche systemd[1]: Unit vsftpd.service entered failed state.
    Dec 17 15:17:25 niche systemd[1]: Stopped Vsftpd ftp daemon.
    Dec 17 15:23:12 niche systemd[1]: Stopped Vsftpd ftp daemon.
    Dec 17 15:26:11 niche systemd[1]: Stopped Vsftpd ftp daemon.
    Dec 17 15:33:55 niche systemd[1]: Stopped Vsftpd ftp daemon.
    Dec 17 15:34:11 niche systemd[1]: Stopped Vsftpd ftp daemon.
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@niche vsftpd]# systemctl stop vsftpd
    [root@niche vsftpd]# systemctl start vsftpd
    Job for vsftpd.service failed. See 'systemctl status vsftpd.service' and 'journalctl -xn' for details.
    [root@niche vsftpd]#

    最后的解决的方法,手动杀死 进程。

    ps auxf | grep vsftpd。

    然后在重新启动 systemctl start vsftpd,又能够使用systemctl来控制vsftpd了,真的是有点出鬼?


    2)禁用匿名用户,本来一開始就改动了vsftpd.conf。可是怎么都无法重新启动无法生效。如今手动杀死进程才干够。

    3)锁定在根文件夹,禁止local用户跳出根文件夹。測试了非常多次最后这一行才干够:


    chroot_local_user=NO
    chroot_list_enable=YES
    # (default follows)
    chroot_list_file=/etc/vsftpd/chroot_list

    4)改动监听port号:配置文件结尾增加新的port号,listen_port=2001,然后重新启动!(by default.fu@foxmail.com)


    5)同意chroot !

    只对有读写权限的进行!


    pam_service_name=vsftpd
    userlist_enable=YES
    tcp_wrappers=YES
    listen_port=2001
    pasv_min_port=2100
    pasv_max_port=2199
    allow_writeable_chroot=YES


    1、设置被动模式打开的配置文件

    #vim /etc/vsftpd/vsftpd.conf

    加入或改动下面内容

    connect_from_port_10021=YES     //这里的10021port,你能够改动为你喜欢的 
    pasv_min_port=8888           //设置被动模式的port范围。最小port号~最大port号
    pasv_max_port=8899            //我们设置的范围能够不用那么大,但数值最好大些(至少也大于1024)

      2、然后更改防火策略

    #vim /etc/sysconfig/iptables

    加入下面防火规则

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 10021 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 8888:8899 -j ACCEPT



    ======================================================

    2015-1-12 23:37:27补充

    #by default.fu@foxmail.com
    [root@unbox vsftpd]# diff vsftpd.conf vsftpd.conf.bak
    12c12
    < anonymous_enable=NO
    ---
    > anonymous_enable=YES
    29c29
    < anon_upload_enable=NO
    ---
    > #anon_upload_enable=YES
    100,101c100,101
    < chroot_local_user=NO
    < chroot_list_enable=YES
    ---
    > #chroot_local_user=YES
    > #chroot_list_enable=YES
    103c103
    < chroot_list_file=/etc/vsftpd/chroot_list
    ---
    > #chroot_list_file=/etc/vsftpd/chroot_list
    114c114
    < listen=YES
    ---
    > listen=NO
    123c123
    < listen_ipv6=NO
    ---
    > listen_ipv6=YES
    128,131d127
    < listen_port=2100
    < pasv_min_port=8190
    < pasv_max_port=8192
    <
    [root@unbox vsftpd]#




  • 相关阅读:
    Access的相关SQL语句
    决心创业
    [转]在.NET环境中使用单元测试工具NUnit
    [转]IE"单击以激活控件"网站代码解决法
    [转]C#中ToString格式大全
    [转]div中放flash运行30秒钟后自动隐藏效果
    Property和attribute的区别
    C++中的虚函数(virtual function)
    进程间通信方式
    关于页面传值的方法
  • 原文地址:https://www.cnblogs.com/cynchanpin/p/7123669.html
Copyright © 2020-2023  润新知