作者:手机用户2602932623 | 来源:互联网 | 2014-05-28 09:12
1、安装在debian下,安装proftpd非常简单,使用apt-getinstallproftpd但需要注意的是,使用命令apt-cachesearchproftpd*会有如下的结果proftpd-doc?Versatile,virtual-hostingFTPdaemon(Documentation)proftpd
1、安装
在debian下,安装proftpd非常简单,使用
apt-get install proftpd
但需要注意的是,使用命令
apt-cache search proftpd*
会有如下的结果
proftpd-doc ? Versatile, virtual-hosting FTP daemon
(Documentation)
proftpd-ldap ? Versatile, virtual-hosting FTP daemon (with LDAP
support)
proftpd-mysql ? Versatile, virtual-hosting FTP daemon (with SQL
support)
proftpd-pgsql ? Versatile, virtual-hosting FTP daemon (with SQL
support)
说明debian下面的proftpd根据所支持的模块,deb包的名称也不一样。如安装mysql支持,直接安装proftpd-mysql。这点和redhat不同,不需要在安装过程中安装各种模块了
对于我,因为需要配置的是支持虚拟用户的proftpd,所以安装
apt-get install proftpd-mysql
这样proftpd就安装了。配置文件为/etc/proftpd.conf
所有的配置都要在这里面写。
下面是默认安装后的配置文件,不需要多解释了,很容易理解。类似apache的配置方法
#
# /etc/proftpd.conf — This is a basic ProFTPD configuration
file.
# To really apply changes reload proftpd after modifications.
#
ServerName ”Debian”
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
DisplayLogin
welcome.msg
DisplayFirstChdir
.message
ListOptions
”-l”
DenyFilter \*.*/
# Uncomment this if you are using NIS or LDAP to retrieve
passwords:
#PersistentPasswd off
# Uncomment this if you would use TLS module:
#TLSEngine on
# Uncomment this if you would use quota module:
#Quotas on
# Uncomment this if you would use ratio module:
#Ratios on
# Port 21 is the standard FTP port.
Port 21
# 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 30
# 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
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Delay engine reduces impact of the so-called Timing Attack
described in
#
http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02
# It is on by default.
#DelayEngine off
# A basic anonymous configuration, no upload directories.
#
#
User ftp
#
Group nogroup
# # We want clients to be able to login with
“anonymous” as well as “ftp”
# UserAlias
anonymous ftp
# # Cosmetic changes, all files belongs to
ftp user
# DirFakeUser on ftp
# DirFakeGroup on ftp
#
# RequireValidShell
off
#
# # Limit the maximum number of anonymous
logins
# MaxClients
10
#
# # We want ‘welcome.msg’ displayed at login,
and ‘.message’ displayed
# # in each newly chdired directory.
#
DisplayLogin welcome.msg
# DisplayFirstChdir
.message
#
# # Limit WRITE everywhere in the anonymous
chroot
#
#
WRITE>
#
DenyAll
#
#
#
# # Uncomment this if you’re brave.
# #
# # # Umask 022 is a
good standard umask to prevent new files and dirs
# # # (second parm)
from being group and world writable.
# #
Umask 022 022
#
#
#
#
DenyAll
#
#
#
#
#
#
AllowAll
#
#
# #
#
#
把原始的配置文件修改一下,然后进行我们自己的配置就可以了:0
proftpd在默认情况下不记录日志,这样就对于我们配置服务器不利,因为不能方便的知道错误信息。所以在最上面添加下面2行
SyslogLevel
emerg
SystemLog
/ftp/log/proftpd.log
#这里是自己的服务器日志路径,修改成自己的:)
从上到下,修改
ServerName ”Meteor’s Ftp”
ServerAdmin
MaxInstances 30
#这是最大连接数,如果机器够好,不妨修改的大点
下面的这个无需修改
User nobody
Group nogroup
User 和Group 指定proftpd
进程启动时的有效用户ID,处于安全考虑默认的身份是nobody,有一点要指出的是,一般Red Linux 9.0
中默认是没有nogroup 这个组的,把Group指定为nobody 即可。
Umask 022 022
#无需修改
DefaultRoot ~
限定用户只能在自己的目录中,肯定要写的了吧
AllowRetrieveRestart on
AllowStoreRestart
on
#这2句是使proftpd支持断点续传
ServerIdent
off
#安全起见,关闭服务器信息的显示。这里关闭掉之后,默认看不到welcome信息。但可以在下面的对用户的设置中进行指定欢迎信息。
?权限设置——————————————————————————————————-
proftpd默认用户可以使用系统非root组的用户登录,登陆后都在自己的/home目录中。
同时匿名用户不能登陆。而要对权限进行进一步的设置,需要在proftpd.conf里面进行定制。
在默认的conf中,有如下的例子
#
#
User ftp
#
Group nogroup
# # We want clients to be able to login with
“anonymous” as well as “ftp”
# UserAlias
anonymous ftp
# # Cosmetic changes, all files belongs to
ftp user
# DirFakeUser on ftp
# DirFakeGroup on ftp
#
# RequireValidShell
off
#
# # Limit the maximum number of anonymous
logins
# MaxClients
10
#
# # We want ‘welcome.msg’ displayed at login,
and ‘.message’ displayed
# # in each newly chdired directory.
#
DisplayLogin welcome.msg
# DisplayFirstChdir
.message
#
# # Limit WRITE everywhere in the anonymous
chroot
#
#
WRITE>
#
DenyAll
#
#
#
# # Uncomment this if you’re brave.
# #
# # # Umask 022 is a
good standard umask to prevent new files and dirs
# # # (second parm)
from being group and world writable.
# #
Umask 022 022
#
#
#
#
DenyAll
#
#
#
#
#
#
AllowAll
#
#
# #
#
#
proftpd的配置文件的格式和apache很相似:
#全局设置
设置项目1 参数1
设置项目2 参数2
#某个目录的设置
…
#关于匿名用户的设置
…
..
其中最重要的就是limit之中的部分,涉及到了具体的权限控制
CMD:Change Working Directory 改变目录
MKD:MaKe Directory 建立目录的权限
RNFR: ReName FRom 更改目录名的权限
DELE:DELEte 删除文件的权限
RMD:ReMove Directory 删除目录的权限
RETR:RETRieve 从服务端下载到客户端的权限
STOR:STORe 从客户端上传到服务端的权限
READ:可读的权限,不包括列目录的权限,相当于RETR,STAT等
WRITE:写文件或者目录的权限,包括MKD和RMD
DIRS:是否允许列目录,相当于LIST,NLST等权限,还是比较实用的
ALL:所有权限
LOGIN:是否允许登陆的权限
针对这些设置,又有如下具体的配置:
AllowUser 针对某个用户允许的Limit
DenyUser 针对某个用户禁止的Limit
AllowGroup 针对某个用户组允许的Limit
DenyGroup 针对某个用户组禁止的Limit
AllowAll 针对所有用户组允许的Limit
DenyAll 针对所有用户禁止的Limit
同时,可以针对单独的用户来限制速度
TransferRate STOR|RETR 速度(Kbytes/s) user 使用者
而对于虚拟用户,无法登陆的。所以,必须修改为
下面是我的配置
User
ftp
#指定用户的组和名称
Group nogroup
UserAlias anonymous
ftp
#使得ftp和匿名用户都能登陆
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell
off
MaxClients
50