zoukankan      html  css  js  c++  java
  • 搭建 CentOS 6 服务器(11)

     

    (一)vsftpd

    安装

     
    1. # yum -y install vsftpd  
    2.     Installed:  
    3.       vsftpd.i686 0:2.2.2-12.el6_5.1  



    设置

     
    1. # cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.backup  
    2. # vi /etc/vsftpd/vsftpd.conf  
    3.     # 不允许匿名用户登录  
    4.     anonymous_enable=NO  
    5.     # 设置空闲时间  
    6.     idle_session_timeout=300  
    7.     # 设置链接超时时间  
    8.     data_connection_timeout=30  
    9.     # 允许上传下载  
    10.     ascii_upload_enable=YES  
    11.     ascii_download_enable=YES  
    12.     # 登陆后的欢迎词  
    13.     ftpd_banner=Welcome to Myvsftpd FTP service.  
    14.     # 不允许一般用户访问上层文件夹  
    15.     chroot_local_user=YES  
    16.     chroot_list_enable=YES  
    17.     # 可以访问上层文件夹的用户一览  
    18.     chroot_list_file=/etc/vsftpd/chroot_list  
    19.     # 允许删除文件夹  
    20.     ls_recurse_enable=YES  
    21.     # 只允许「/etc/vsftpd/user_list」内的用户访问  
    22.     userlist_enable=NO  



    用户设置

     
    1. # vi /etc/vsftpd/chroot_list  
    2.     root  
    3. # /usr/sbin/useradd ftpuser1 -d /home/ftpuser1 -G nobody  
    4. # passwd ftpuser1  
    5.     New password: 123456  
    6.     Retype new password: 123456  
    7.     passwd: all authentication tokens updated successfully.  
    8. # vi /etc/vsftpd/user_list  
    9.     ftpuser1  
    10. # vi /etc/hosts.allow  
    11.     vsftpd : 192.168.21. 127.0.0.1  
    12. # vi /etc/hosts.deny  
    13.     vsftpd : ALL  



    启动服务

     
    1. # /etc/rc.d/init.d/vsftpd start  



    (二)ProFTPD

    下载安装

     
    1. # cd /usr/local/src  
    2. # wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.5.tar.gz  
    3. # tar xvfz proftpd-1.3.5.tar.gz  
    4. # cd proftpd-1.3.5  
    5. # ./configure --enable-nls --prefix=/usr/local/proftpd  
    6. # make  
    7. # make install  



    创建用户

     
    1. # cd /usr/local/proftpd/bin  
    2. # /usr/sbin/useradd ftpuser1 -d /home/ftpuser1 -G nobody  
    3. # passwd ftpuser1  
    4.     New password: 123456  
    5.     Retype new password: 123456  
    6.     passwd: all authentication tokens updated successfully.  



    做成私有密码文件

     
    1. # id ftpuser1  
    2. # ./ftpasswd --passwd --file=/usr/local/proftpd/etc/ftpd.passwd --name=ftpuser1   
    3.   --uid=502 --gid=502 --home=/home/ftpuser1 --shell=/bin/bash  
    4.     ftpasswd: using alternate file: /usr/local/proftpd/etc/ftpd.passwd  
    5.     ftpasswd: creating passwd entry for user ftpuser1  
    6.   
    7.     Password:111111  
    8.     Re-type password:111111  
    9.   
    10.     ftpasswd: entry created  
    11. # ./ftpasswd --group --file=/usr/local/proftpd/etc/ftpd.group   
    12.   --name=ftpuser1 --gid=502  
    13.     ftpasswd: using alternate file: /usr/local/proftpd/etc/ftpd.group  
    14.     ftpasswd: creating group entry for group ftpuser1  
    15.     ftpasswd: entry created  



    设置

     
    1. # cp /usr/local/proftpd/etc/proftpd.conf /usr/local/proftpd/etc/proftpd.conf.bak  
    2. vi /usr/local/proftpd/etc/proftpd.conf  
    3.     ServerName "Welcome to MyProFTPD FTP service."  
    4.     Group nobody  
    5.     DefaultRoot ~  
    6.     注释掉「<Anonymous ~ftp>」 到 「</Anonymous>」  
    7.     ExtendedLog /var/log/proftp.log all  
    8.   
    9.     <Directory />  
    10.       HideFiles ^..*  
    11.     </Directory>  
    12.   
    13.     AuthUserFile                    /usr/local/proftpd/etc/ftpd.passwd  
    14.     AuthGroupFile                   /usr/local/proftpd/etc/ftpd.group  
    15.     AuthOrder                       mod_auth_file.c  
    16.   
    17.     MaxClientsPerHost 2   
    18.     MaxClients 20  
    19.   
    20.     PathAllowFilter .(jpg|gif|png|jpeg)$  
    21.     MaxStoreFileSize 3 Mb  
    22.   
    23.     ListOptions -a maxfiles 1000  



    启动脚本

     
    1. # cd /usr/local/src/proftpd-1.3.5/contrib/dist/rpm  
    2. # cp proftpd.init.d /etc/init.d/proftpd  
    3. # vi /etc/init.d/proftpd  
    4. # chmod +x /etc/init.d/proftpd  



    启动服务

     
    1. # /etc/init.d/proftpd start  



    FTP确认测试
    C:Documents and SettingsRenSanNing>ftp

    连接
    ftp> op
    To 192.168.21.xxx
    Connected to 192.168.21.xxx.
    220 Welcome to MyProFTPD FTP service.
    User (192.168.21.xxx:(none)): ftpuser1
    331 Please specify the password.
    Password:
    230 Login successful.

    变更文件夹
    ftp> pwd
    257 "/"
    ftp> cd /root/
    550 Failed to change directory.
    ftp> cd /etc/
    550 Failed to change directory.

    上传文件
    ftp> put c: est.txt
    200 PORT command successful. Consider using PASV.
    150 Ok to send data.
    226 Transfer complete.
    ftp: 7 bytes sent in 0.00Seconds 7000.00Kbytes/sec.

    确认文件
    ftp> ls -l
    200 PORT command successful. Consider using PASV.
    150 Here comes the directory listing.
    -rw-r--r--    1 503      503             7 Aug 20 11:51 test.txt
    226 Directory send OK.
    ftp: 66 bytes received in 0.00Seconds 66000.00Kbytes/sec.

    下载文件
    ftp> get test.txt
    200 PORT command successful. Consider using PASV.
    150 Opening ASCII mode data connection for test.txt (7 bytes).
    226 Transfer complete.
    ftp: 7 bytes received in 0.00Seconds 7000.00Kbytes/sec.

    ftp> bye
    221 Goodbye.

    客户端工具:
    FFFTP:http://sourceforge.jp/projects/ffftp/
    FileZilla:https://filezilla-project.org/

  • 相关阅读:
    DELPHI中GetTickCount 函数的应用
    Delphi 中 StrToIntDef 函数的应用
    TeeChart 动态建曲线
    历遍指定文件夹下的文件
    DELPHI 获取错误信息
    delphi播放flash
    C# 获取当前路径方法
    DELPHI 修改系统分辨率
    SQL字符串处理函数 Yang
    Linux基本操作 Yang
  • 原文地址:https://www.cnblogs.com/kyli816/p/4627137.html
Copyright © 2011-2022 走看看