ProFTPD文件共享

源自《Linux 运维之道》丁一明编著 一书的总结

它是一个安全、配置简单的FTP服务器软件。

[root@localhost tempal]# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.5rc4.tar.gz

[root@localhost tempal]# tar zxfv proftpd-1.3.5rc4.tar.gz

[root@localhost tempal]# tar -xzf proftpd-1.3.5rc4.tar.gz -C /usr/src/

[root@localhost tempal]# cd /usr/src/

[root@localhost src]# cd proftpd-1.3.5rc4/

[root@localhost proftpd-1.3.5rc4]# ./configure --prefix=/usr/local/proftpd --sysconfdir=/etc/ --enable-nls --enable--openssl --enable-shadow

[root@localhost proftpd-1.3.5rc4]# make && make install

[root@localhost proftpd-1.3.5rc4]# PATH=$PATH:/usr/local/proftpd/bin

[root@localhost proftpd-1.3.5rc4]# useradd -M -s /sbin/nologin proftp

原本配置文件/etc/proftpd.conf内容

# This is a basic ProFTPD configuration file (rename it to

# 'proftpd.conf' for actual use. It establishes a single server

# and a single anonymous login. It assumes that you have a user/group

# "nobody" and "ftp" for normal operation and anon.

ServerName "ProFTPD Default Installation"#客户端连接后显示的提示字符

ServerType standalone#服务器启动模式,独立后台进程

DefaultServer on#作为默认服务器

# Port 21 is the standard FTP port.

Port 21#默认监听21端口

# Don't use IPv6 support by default.

UseIPv6 off#禁用ipv6

# Umask 022 is a good standard umask to prevent new dirs and files

# from being group and world writable.

Umask 022#权限掩码

# 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 under which the server will run.

User nobody#启动服务器的帐号

Group nogroup#启动服务器的组帐号

# To cause every FTP user to be "jailed" (chrooted) into their home

# directory, uncomment this line.

#DefaultRoot ~

# Normally, we want files to be overwriteable.

AllowOverwrite on#允许文件覆盖权限

# Bar use of SITE CHMOD by default

<Limit SITE_CHMOD>

DenyAll

</Limit>

# A basic anonymous configuration, no upload directories. If you do not

# want anonymous users, simply delete this entire <Anonymous> section.

<Anonymous ~ftp>#匿名访问设置,默认为匿名访问,默认的,应该注释掉

User ftp

Group ftp

# We want clients to be able to login with "anonymous" as well as "ftp"

UserAlias anonymous ftp

# 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

DisplayChdir .message

# Limit WRITE everywhere in the anonymous chroot

<Limit WRITE>

DenyAll

</Limit>

</Anonymous>

配置文件解释【转http://www.njhnh.cn/blog/?action=show&id=87】

1、Proftpd如何限速和设置发呆退出?

可以使用:

RateReadBPS RateReadFreeBytes

RateWriteBPS RateWriteFreeBytes

来限制下载和上载速度:

RateReadBPS和RateWriteBPS限制下载和上载的速率

RateReadFreeBytes和RateWriteFreeBytes限制当用户现在这么多数据量以后再进行限速,这样可以实现对于小文件不限速,而大文件限速。

TimeoutIdle -- 设置空闲连接超时时钟

TimeoutLogin -- 设置空闲登陆超时时钟

TimeoutNoTransfer -- 设置当没有数据传输时的超时时钟

TimeoutStalled -- 设置被阻塞的下载的超时时钟

2、proftpd如何实现磁盘限额

首先编译的时候指定--with-modules的时候要包含mod_quota。

然后在配置文件中使用:

Quotas on

QuotaCalc on

DefaultQuota 8000

QuotaBlockSize 1024

QuotaBlockName kb

就可以实现磁盘限额。其中DefaultQuota说明用户只能用8000个block,而QuotaBlockSize则指明每个block大小是1024byte也就是1k。

QuotaBlockName只在提示中出现,告诉用户block的单位。

3、如何设置proftpd的服务进程数

如果机器硬件配置不是非常好,或者为了防止DoS攻击,有时候需要限制proftpd所能提供的同时连接数。在standalone情况下,可以设置:

MaxInstances 100

这样就能限制当外界的所有连接数到100的时候,proftpd将禁止新连接。

4、Proftpd如何限制每个客户端机器的同时连接

只要在配置文件里面使用:

MaxClientsPerHost 10

这样限制客户端机器最多只能10个连接。用在匿名用户的配置中特别有用,有效地防止了某个客户端大量占用了其他人的连接数。

5、Proftpd如何限制某个用户的同时连接数

Proftpd 1.2.7rc1以后提供了一个新参数-MaxClientsPerUser。在配置文件中添加下列参数:

MaxClientsPerUser 5

这样就能限制每个用户只能同时有5个连接,使用例如flashget等下载工具的时候就最多只能分成5块下载。

6、Proftpd如何提供续传功能

如果要支持下载续传,那么必须指定:

AllowRetrieveRestart on

如果要支持上传续传,那么必须指定:

AllowOverwrite on

AllowStoreRestart on

必须同时指定AllowOverwrite和AllowStoreRestart的原因是由于重新上传或者续传也是属于覆盖文件。

同时记得不要同时使用HiddenStor和AllowStoreRestart。

7、proftpd如何允许以root身份登录

在配置文件中使用下面的配置:

RootLogin on

8、如何缩短连接到proftpd服务的时间

在proftpd.conf里面加入两行:

UseReverseDNS off

IdentLookups off

防止proftpd进行DNS反查以及对用户端进行ident确认。

posted @ 2014-06-29 20:55  Tempal  阅读(968)  评论(0编辑  收藏  举报