`
rensanning
  • 浏览: 3515177 次
  • 性别: Icon_minigender_1
  • 来自: 大连
博客专栏
Efef1dba-f7dd-3931-8a61-8e1c76c3e39f
使用Titanium Mo...
浏览量:37503
Bbab2146-6e1d-3c50-acd6-c8bae29e307d
Cordova 3.x入门...
浏览量:604411
C08766e7-8a33-3f9b-9155-654af05c3484
常用Java开源Libra...
浏览量:678182
77063fb3-0ee7-3bfa-9c72-2a0234ebf83e
搭建 CentOS 6 服...
浏览量:87338
E40e5e76-1f3b-398e-b6a6-dc9cfbb38156
Spring Boot 入...
浏览量:399875
Abe39461-b089-344f-99fa-cdfbddea0e18
基于Spring Secu...
浏览量:69090
66a41a70-fdf0-3dc9-aa31-19b7e8b24672
MQTT入门
浏览量:90519
社区版块
存档分类
最新评论

搭建 CentOS 6 服务器(9) - vsftpd、ProFTPD

 
阅读更多
(一)vsftpd

安装
# yum -y install vsftpd
    Installed:
      vsftpd.i686 0:2.2.2-12.el6_5.1


设置
# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.backup
# vi /etc/vsftpd/vsftpd.conf
    # 不允许匿名用户登录
    anonymous_enable=NO
    # 设置空闲时间
    idle_session_timeout=300
    # 设置链接超时时间
    data_connection_timeout=30
    # 允许上传下载
    ascii_upload_enable=YES
    ascii_download_enable=YES
    # 登陆后的欢迎词
    ftpd_banner=Welcome to Myvsftpd FTP service.
    # 不允许一般用户访问上层文件夹
    chroot_local_user=YES
    chroot_list_enable=YES
    # 可以访问上层文件夹的用户一览
    chroot_list_file=/etc/vsftpd/chroot_list
    # 允许删除文件夹
    ls_recurse_enable=YES
    # 只允许「/etc/vsftpd/user_list」内的用户访问
    userlist_enable=NO


用户设置
# vi /etc/vsftpd/chroot_list
    root
# /usr/sbin/useradd ftpuser1 -d /home/ftpuser1 -G nobody
# passwd ftpuser1
    New password: 123456
    Retype new password: 123456
    passwd: all authentication tokens updated successfully.
# vi /etc/vsftpd/user_list
    ftpuser1
# vi /etc/hosts.allow
    vsftpd : 192.168.21. 127.0.0.1
# vi /etc/hosts.deny
    vsftpd : ALL


启动服务
# /etc/rc.d/init.d/vsftpd start


(二)ProFTPD

下载安装
# cd /usr/local/src
# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.5.tar.gz
# tar xvfz proftpd-1.3.5.tar.gz
# cd proftpd-1.3.5
# ./configure --enable-nls --prefix=/usr/local/proftpd
# make
# make install


创建用户
# cd /usr/local/proftpd/bin
# /usr/sbin/useradd ftpuser1 -d /home/ftpuser1 -G nobody
# passwd ftpuser1
    New password: 123456
    Retype new password: 123456
    passwd: all authentication tokens updated successfully.


做成私有密码文件
# id ftpuser1
# ./ftpasswd --passwd --file=/usr/local/proftpd/etc/ftpd.passwd --name=ftpuser1 \
  --uid=502 --gid=502 --home=/home/ftpuser1 --shell=/bin/bash
    ftpasswd: using alternate file: /usr/local/proftpd/etc/ftpd.passwd
    ftpasswd: creating passwd entry for user ftpuser1

    Password:111111
    Re-type password:111111

    ftpasswd: entry created
# ./ftpasswd --group --file=/usr/local/proftpd/etc/ftpd.group \
  --name=ftpuser1 --gid=502
    ftpasswd: using alternate file: /usr/local/proftpd/etc/ftpd.group
    ftpasswd: creating group entry for group ftpuser1
    ftpasswd: entry created


设置
# cp /usr/local/proftpd/etc/proftpd.conf /usr/local/proftpd/etc/proftpd.conf.bak
vi /usr/local/proftpd/etc/proftpd.conf
    ServerName "Welcome to MyProFTPD FTP service."
    Group nobody
    DefaultRoot ~
    注释掉「<Anonymous ~ftp>」 到 「</Anonymous>」
    ExtendedLog /var/log/proftp.log all

    <Directory />
      HideFiles ^\..*
    </Directory>

    AuthUserFile                    /usr/local/proftpd/etc/ftpd.passwd
    AuthGroupFile                   /usr/local/proftpd/etc/ftpd.group
    AuthOrder                       mod_auth_file.c

    MaxClientsPerHost 2 
    MaxClients 20

    PathAllowFilter \.(jpg|gif|png|jpeg)$
    MaxStoreFileSize 3 Mb

    ListOptions -a maxfiles 1000


启动脚本
# cd /usr/local/src/proftpd-1.3.5/contrib/dist/rpm
# cp proftpd.init.d /etc/init.d/proftpd
# vi /etc/init.d/proftpd
# chmod +x /etc/init.d/proftpd


启动服务
# /etc/init.d/proftpd start


FTP确认测试
C:\Documents and Settings\RenSanNing>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:\test.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/
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics