1- 使用下面的命令安装proftpd:
Code:
sudo apt-get install proftpd
2- 在etc/shells 加入如下代码 (sudo gedit /etc/shells to open the file)(译注:命令行模式下sudo vi /etc/shells) :
Code:
/bin/false
新建一个 /home/FTP-shared 目录 :
Code:
cd /home
sudo mkdir FTP-shared
创建一个只能用来读取ftp的用户userftp. 这个用户不需要有效的shell(更安全) ,所以选择 /bin/false shell 给 userftp , /home/FTP-shared 作为主目录。
为了是这部分更清楚,我给取此操作的命令行:
Code:
sudo useradd userftp -p your_password -d /home/FTP-shared -s /bin/false
在FTP-shared 目录下新建一个download和一个upload 目录:
Code:
cd /home/FTP-shared/
sudo mkdir download
sudo mkdir upload
现在我们来给它们设置相应的权限:
Code:
cd /home
sudo chmod 755 FTP-shared
cd FTP-shared
sudo chmod 755 download
sudo chmod 777 upload
3- 好了,现在进入proftpd的配置文件:
Code:
sudo gedit /etc/proftpd/proftpd.conf //特别注意路径,网上以前给的是错的
当然你可以按你的需要编辑你自己的proftpd.conf:
Code:
# To really apply changes reload proftpd after modifications.
AllowOverwrite on
AuthAliasOnly on
# Choose here the user alias you want !!!!
UserAlias sauron 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)