標籤:
(一)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/
搭建 CentOS 6 伺服器(11) - vsftpd、ProFTPD