1. 安装proftpd1
------------------
shell> tar zxvf proftpd-1.2.10.tar.gz
shell> cd proftpd-1.2.10
shell> ./configure --prefix=/usr/local/proftpd
shell> make
shell> make install
2. 创建ftpassswd命令
------------------------
从 http://www.castaglia.org/proftpd/contrib/ftpasswd 获得ftpasswd的perl源代码,
并保存为 /usr/local/proftpd/sbin/ftpasswd 。
shell> chmod 755 /usr/local/proftpd/sbin/ftpasswd
通过ftpasswd命令,可以对ProFTPD的虚拟用户进行治理。
shell> echo "wheel:*:0:" >> /usr/local/proftpd/etc/ftpd.group
shell> /usr/local/proftpd/sbin/ftpasswd --passwd --name=admin --uid=2001 --gid=0 --home=/ftp/admin --shell=/bin/bash --file=/usr/local/proftpd/etc/ftpd.passwd
...
Password: <new password>
Re-type password: <new password>
shell> /usr/local/proftpd/sbin/ftpasswd --passwd --name=tom --uid=2101 --gid=2000 --home=/ftp/tom --shell=/usr/sbin/nologin --file=/usr/local/proftpd/etc/ftpd.passwd
...
Password: <new password>
Re-type password: <new password>
之后会自动生成/usr/local/proftpd/etc/ftpd.passwd
shell> chmod -R 777 /ftp/admin
shell> chmod -R 777 /ftp/tom
要注重,因为虚拟用户并不在本地系统用户中存在,所以要设置虚拟用户可以访问的所有目录都答应其它用户写,这样才能保证虚拟用户正常增删文件。
3. 接下来配置proftpd.conf
-----------------------------
shell> vi /usr/local/proftpd/etc/proftpd.conf
ServerName "My FTP Server"
ServerType standalone
DefaultServer on
Bind 10.210.66.130
ExtendedLog /var/log/proftpd read,write,auth
# 原来的设置项是ScoreboardPath,但现在版本的proftpd已不再支持,改用ScoreboardFile
ScoreboardFile /usr/local/proftpd/var/proftpd/proftpd.scoreboard
Port 21
Umask 022
MaxInstances 50
MaxClients 20
# 假如答应匿名访问或多人共用同一帐号,MaxHostsPerUser和MaxClientsPerUser不应设置过小,或不用设置
MaxClientsPerHost 3 "Sorry, only 3 connections allowed per user!"
MaxHostsPerUser 1 "Sorry, only 1 host allowed per user!"
MaxClientsPerUser 1 "Sorry, only 1 connection allowed per user!"
TimeoutIdle 600
TimeoutStalled 10
# 不显示服务器相关信息, 如proftpd版本
ServerIdent off
# 禁用反向域名解析
UseReverseDNS off
# 支持FXP
AllowForeignAddress on
# 支持被动模式
PassivePorts 49152 65534
AllowOverwrite on
# 答应下载续传,默认即开启,但为了明确我显示地声明
AllowRetrieveRestart on
# 答应上载续传
AllowStoreRestart on
DisplayLogin welcome.msg
DisplayFirstChdir .message
User nobody
Group nogroup
# 不要求有合法shell,直接效果是答应nologin用户和虚拟用户登录
RequireValidShell off
# 设置用户验证顺序是先虚拟用户再本地用户
AuthOrder mod_auth_file.c mod_auth_unix.c
# 指定虚拟用户数据文件
AuthUserFile /usr/local/proftpd/etc/ftpd.passwd
# 指定虚拟组数据文件
AuthGroupFile /usr/local/proftpd/etc/ftpd.group
评论加载中…
![]() |