搭建 CentOS 6 伺服器(11) - vsftpd、ProFTPD

來源:互聯網
上載者:User

標籤:

 

(一)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 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/

搭建 CentOS 6 伺服器(11) - vsftpd、ProFTPD

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.