1. sudo apt-get install proftpd
2. sudo vim /etc/shells
檢查是否有/bin/false 這一行
沒有便加入.
3.Create a /home/FTP-shared directory :
cd /home
sudo mkdir FTP-shared
sudo useradd userftp -p your_password -d /home/FTP-shared -s /bin/false
(shell 設為/bin/false的目的, 是為了使user無法用telnet, ssh等模式登入)
cd /home/FTP-shared/
sudo mkdir download
sudo mkdir upload
cd /home
sudo chmod 755 FTP-shared
cd FTP-shared
sudo chmod 755 download
sudo chmod 777 upload
設定proftpd configuration file
sudo vim /etc/proftpd.conf
以下是設定參考:
=========================================
# To really apply changes reload proftpd after modifications.
AllowOverwrite on
AuthAliasOnly on
# Choose here the user alias you want !!!!
UserAlias orz userftp
ServerName "ChezFrodon"
ServerType standalone
DeferWelcome on
MultilineRFC2228 on
DefaultServer on
ShowSymlinks off
TimeoutNoTransfer 600
TimeoutStalled 100
TimeoutIdle 2200
DisplayFirstChdir .message
ListOptions "-l"
RequireValidShell off
TimeoutLogin 20
RootLogin off
# It's better for debug to create log files ;-)
ExtendedLog /var/log/ftp.log
TransferLog /var/log/xferlog
SystemLog /var/log/syslog.log
#DenyFilter \*.*/
# I don't choose to use /etc/ftpusers file (set inside the users you want to ban, not useful for me)
UseFtpUsers off
# Allow to restart a download
AllowStoreRestart on
# Port 21 is the standard FTP port, so don't use it for security reasons (choose here the port you want)
Port 1980
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 8
# Set the user and group that the server normally runs at.
User nobody
Group nogroup
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
PersistentPasswd off
MaxClients 8
MaxClientsPerHost 8
MaxClientsPerUser 8
MaxHostsPerUser 8
# Display a message after a successful login
AccessGrantMsg "welcome !!!"
# This message is displayed for each access good or not
ServerIdent on "you're at home"
# Set /home/FTP-shared directory as home directory
DefaultRoot /home/FTP-shared
# Lock all the users in home directory, ***** really important *****
DefaultRoot ~
MaxLoginAttempts 5
#VALID LOGINS
<Limit LOGIN>
AllowUser userftp
DenyALL
</Limit>
<Directory /home/FTP-shared>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory /home/FTP-shared/download/*>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory> /home/FTP-shared/upload/>
Umask 022 022
AllowOverwrite on
<Limit READ RMD DELE>
DenyAll
</Limit>
<Limit STOR CWD MKD>
AllowAll
</Limit>
</Directory>
=========================================
之後,你便可以使用
user:orz
passwd: (userftp的passwd)
port: 1980
來登入ftp服務.
重開proftpd服務
sudo /etc/init.d/proftpd start
sudo /etc/init.d/proftpd stop
sudo /etc/init.d/proftpd restart
To perform a syntax check of your proftpd.conf file :
Code:
輸入下列指令,檢查proftpd.conf 的設定語法是否正確.
sudo proftpd -td5
ftptop:可以觀察有哪些client登入ftp service (按 t 可以流量模式觀看)
ftpwho:亦可觀察目前登入ftp的使用者.
ubuntu下裝iptraf, 可以即時監看網路流量資訊.
apt-get instatll iptraf
sudo iptraf
以下轉錄自Cyberpunk
加速proftp的login速度:
修改proftpd.conf,加入下列兩行
UseReverseDNS off
IdentLookups off
這兩個設定分別的意義如下:
- UseReverseDNS:在使用者登入時反查對方的DNS記錄。
- IdentLookups:在使用者登入時反查對方的Username。(RFC1413:ident通訊協定,用來判斷此連線的使用者名稱。)
No comments:
Post a Comment