• Linux上rpm实战搭建FTP服务器


    1.检测是否已安装FTP服务

    # rpm -qa|grep vsftpd

    2.未安装ftp服务的前提进行使用rpm安装

    # yum install vsftpd -y

    Loaded plugins: security
    base                                                                | 3.7 kB     00:00     
    epel                                                                | 4.7 kB     00:00     
    epel/primary_db                                                     | 6.0 MB     00:00     
    extras                                                              | 3.4 kB     00:00     
    extras/primary_db                                                   |  29 kB     00:00     
    updates                                                             | 3.4 kB     00:00     
    updates/primary_db                                                  | 5.8 MB     00:00     
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package vsftpd.x86_64 0:2.2.2-24.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ===========================================================================================
     Package             Arch                Version                   Repository         Size
    ===========================================================================================
    Installing:
     vsftpd              x86_64              2.2.2-24.el6              base              156 k
    
    Transaction Summary
    ===========================================================================================
    Install       1 Package(s)
    
    Total download size: 156 k
    Installed size: 340 k
    Downloading Packages:
    vsftpd-2.2.2-24.el6.x86_64.rpm                                      | 156 kB     00:00     
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : vsftpd-2.2.2-24.el6.x86_64                                              1/1 
      Verifying  : vsftpd-2.2.2-24.el6.x86_64                                              1/1 
    
    Installed:
      vsftpd.x86_64 0:2.2.2-24.el6                                                             
    
    Complete!

    下载并安装完成。

    3.启动服务

     # service vsftpd start

    Starting vsftpd for vsftpd:                                [  OK  ]

    启动ftp命令#service vsftpd start

    停止ftp命令#service vsftpd stop

    重启ftp命令#service vsftpd restart

    4.配置FTP参数

    4.1 匿名用户

    #vim  /etc/vsftpd/vsftpd.conf  -- 编辑配置文件
    anonymous_enable=NO  -- 修改配置项  禁止匿名登录 
    #anon_upload_enable=YES      上传 
    #anon_mkdir_write_enable=YES    创建 
    #anon_other_write_enable=YES    删除 
    #service vsftpd restart

    4.2 创建一个用户和密码

    #useradd -s /sbin/nologin testaccount --创建账号
    #passwd testaccount  -- 为创建好的账号进行设置密码
    Changing password for user viong.
    New password: 
    BAD PASSWORD: it is based on a dictionary word
    Retype new password: 
    passwd: all authentication tokens updated successfully.

    4.3 设置用户只限于访问自身目录

    vim /etc/vsftpd/vsftpd.conf
    
    -- 在最后一行加上
    chroot_list_enable=YES -- //限制访问自身目录
    # (default follows)
    chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

    切入到/etc/vsftpd目录

     编辑 vsftpd.chroot_list文件,将受限制的用户添加进去,每个用户名一行

    [root@gray-web vsftpd]# vim vsftpd.chroot_list
    
    zzbftp -- 添加需要受限制的用户名

    修改完成 重启ftp服务

    [root@gray-web vsftpd]# service vsftpd restart
    Shutting down vsftpd:                                      [  OK  ]
    Starting vsftpd for vsftpd:   

    5.测试连接并上传文件

    命令: LIST
    错误: 无法打开传输通道。原因:由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
    错误: 无法取得目录列表

    搭建好后使用8UFTP发现连接成功,但是响应列表超时了。原因是因为防火墙里面需要设置为主动模式,但是按理说主动模式还更容易出问题,但是测试吧FTP客户端改成主动模式后,顺利登陆FTP服务器,至此问题解决。

     

    修改后连接成功:

     

  • 相关阅读:
    error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
    C# Console 运行之后最小化到状态栏
    CentOS7 设置防火墙端口
    Spring boot 与quart集成并在Job中注入服务
    Cron表达式周1至周5,每天上午8点至下午18点,每分钟执行一次
    Electron 调用系统Office软件
    jquery之超简单的div显示和隐藏特效demo
    IE系列不支持圆角等CSS3属性的解决方案
    使用CSS3建立不可选的的文字
    ASP.NET中使用TreeView显示文件
  • 原文地址:https://www.cnblogs.com/david97/p/8327689.html
Copyright © 2020-2023  润新知