免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3662 | 回复: 10
打印 上一主题 下一主题

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~ [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-06-02 16:27 |只看该作者 |倒序浏览
1.怎样限制单个IP连接数?
2.怎样限制速度、流量?
3.怎样限制空间(上传空间)?
4.怎样设置虚拟目录和虚拟主机?

请手们来问答,最好详细些,我是小菜鸟!^○^

论坛徽章:
0
2 [报告]
发表于 2003-06-02 16:44 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

ding!

论坛徽章:
0
3 [报告]
发表于 2003-06-02 17:00 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

高手们来啦!

论坛徽章:
0
4 [报告]
发表于 2003-06-02 17:06 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

看看这个:

                            ProFTPD 详解



ProFTPD 是开放源码的软件,以 GPL 许可发布。ProFTPD 可以说是 wu-ftpd 的替代,

同时在安全,可伸缩性等方面有很大的提高。特别是对于熟悉 Apache 配置的人而言,

它的配置和 Apache 十分相似,因此,用起来肯定能得心应手。





主要特色:

一个单一的和 Apache 的 httpd.conf 类似的配置文件

每个目录下的 .ftpaccess 文件(和 Apache 的. htaccess 类似)

很容易配置的,多个虚拟 FTP 服务器以及匿名 FTP 服务

可以单独运行也可以从 inetd/xinetd 启动

匿名 FTP 的根目录不需要特别的目录结构

系统的二进制文件和其他系统文件没有 SITE EXEC 命令

在单独运行方式下,以非特权用户运行,降低攻击风险

日志以及 utmp/wtmp 支持

Shadow 口令支持



为了保证系统安全,建议你总是把软件更新到最新的版本。



wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.4.tar.gz



./configure --prefix=/usr/local --enable-shadow

make (如果是双 CPU 建议采用 make -j3)

make install



然后你可以发现 ProFTPD 安装在 /usr/local 下,"proftpd" 可以在/usr/local/sbin/

目录下找到,配置文件 proftpd.conf 位于:/usr/local/etc/ 。



如果你熟悉 Apache 的 httpd.conf 的配置的话, proftpd.conf 的配置十分简单。





DefaultRoot ~ users, !staff

ServerIdent On "FreeLAMP FTP Server"

ServerName ""

ServerType standalone

ServerAdmin webmaster@freelamp.com

Bind 192.168.0.1

ExtendedLog /var/log/proftpd read,write,auth

ScoreboardPath /usr/local/var/proftpd

RequireValidShell Off

User proftpd

Group proftpd



下面我们就可以启动了:



/usr/local/sbin/proftpd &



以上的配置方法十分简单,不再赘述。下面我们看限制匿名用户登录的办法:



#MaxClients 1 "Maximum users reached - try again later"

#MaxClients 1 "Sorry, max %m users -- try again later"

MaxClients None "对不起,本系统不支持匿名登录"







带宽控制:



RateReadBPS 81920

RateReadFreeBytes 5120

RateReadHardBPS on



这样用户的带宽就用公式: "RateReadBPS x MaxClients = Total Bandwidth allocation."

限制起来,但是针对每个虚拟域,每个用户以及全局的限制还没有实现。在 1.2.x 系

列中只有一个全局变量影响整个服务器:



Bandwidth 81920



另外,你还可以采用 "mod_quota" 和 "mod_ratio" 模块来控制用户的磁盘限额。


FAQ



1、我安装proftpd以后,出现了问题,我如何调试?



通过通过命令! /usr/sbin/proftpd -d9 -n启动proftpd来进行调试,则proftp d就会将

调试信息打印到consle上以供调试之用。



2、为什么我的proftpf启动以后,匿名用户不能登录?



        查看proftp配置文件/etc/proftpd.conf,修改<Anonymous ~ftp>;为

        <Anonymous /home/ftp>;(这里/home/ftp可以是任何希望匿名用户登录以后的当前根目录,

        但是确保要使该目录允许ftp用户访问),并且若<Anonymous /home/ftp>;部分的User指令

        指定的用户为ftp用户,则需要在配置文件中添加如下命令指示:



RequireValidShell off



3、我如何实现一个正常用户登录以后将其的访问限定在某个目录之下?



可以通过指令DefaultRoot来实现。例如若希望将ftpusers组的用户限定在自己的home目录下,则

需要首先创建该组:



/usr/sbin/groupadd ftpusers



然后将用户ideal加入到该组中:



usrmod -G ftpusers ideal



最后在在proftpd.conf文件中添加如下内容:



DefaultRoot ~ ftpusers



也可以限制用户登录以后仅仅访问自己主目录下的一个子目录:



Default! Root ~/anoftp ftpusers



当然也可以将用户限制在其他目录之下,而不是自己的home目录下:



DefaultRoot /tmp ftpusers



也可以限定一个用户组的某些用户被限制,而其他不作限制:



DefaultRoot ~ ftpusers,!empolyee



这个指令指示仅仅限制ftpusers组中的不是empolyee组的用户进行限制。



4、我如何使用户登陆时不显示ftp服务器版本信息,以增强安全性?



在proftpd.conf中添加如下内容:



ServerIdent off



则再次登录时,显示如下内容:



C:WINDOWS>;ftp 192.168.2.33

Connected to 192.168.2.33.

220 ftpd.test.com.cn FTP server ready.

User (192.168.2.33none)):



5、在proftpd环境下如何设定虚拟主机?



可以通过指令:VirtualHost来实现,一个最简单的例子:



<VirtualHost 192.168.2.35>;

ServerName "virtual FTP server"

</VirtualHost>;

若你仅仅希望通过匿名访问某个虚拟主机,则使用如下! 的指令:



<VirtualHost 192.168.2.35>;  



Serv erName "virtual FTP server"  



<Limit LOGIN>;  

DenyAll  

</Limit>;  



<Anonymous /usr/local/private>;  



User private

Group private  



<Limit LOGIN>;  

AllowAll  

</Limit>;



</Anonymous>;  



</VirtualHost>;



这样192.168.2.35的这台主机则仅仅允许匿名登录。



一个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 &! quot;test.com.cn FTP Server"

ServerType standalone

DefaultServer on



# Port 21 is the standard FTP port.

Port 21

# 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&! nbsp;limit maximum number of processes per&nb sp;service

# (such as xinetd)

MaxInstances 30





RequireValidShell off

ServerIdent off





# Set the user and group that the server normally runs at.

User nobody

Group nobody



# Normally, we want files to be overwriteable.

<Directory /*>;

AllowOverwrite on

</Directory>;



# A basic anonymous configuration, no upload directories.

<Anonymous /home/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

DisplayFirstChdir .message



# Limit WRITE everywhere in the anonymous chroot

<Limit WRITE>;

DenyAll

</Limit>;



</Anonymous>;





DefaultRoot ~ ftpusers



<VirtualHost 192.168.2.35>;  



ServerName "virtual FTP server"  



<Limit LOGIN>;  

DenyAll  

</Limit>;  



<Anonymous /usr/local/private>;  



User private

Group private  



<Limit LOGIN>;  

AllowAll  

</Limit>;



</Anonymous>;  



</VirtualHost>;





注意事项



a. 若您想限制 FTP 登入的使用者,使他无法切换到别人的自家目录(Home Directory),可在 proftpd.conf 中加上:



 DefaultRoot ~



b. 若您发现使用 WS_FTP 等软体连上FTP时,无法改变档案属性,可在 proftpd.conf 中加上:



 AllowChmod  true



(注意: 必须是 rc1 以後的版本才适用, pre10之前不行!)



c. 若您发现使用匿名ftp登入时出现错误,大概是 /home/ftp/pub这个目录没有开设,

或者,忘了在 proftpd.conf 中加上 RequireValidShell off



d. 若您想将匿名 ftp 关掉,只要将<ANONYMOUS&NBSP;~FTP>; 到 这一段设定用 # 把它mark起来或直接删除即可。



e. 若您是抓 tar.gz 自行编译, 则必须自行手动在 /etc/pam.d/ftp 中加入以下PAM设定(for RedHat Linux)

(假定 /etc/pam.d/ftp不存在,或其中无以下设定的话):



auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed

auth required /lib/security/pam_pwdb.so shadow nullok

account required /lib/security/pam_pwdb.so

session required /lib/security/pam_pwdb.so

论坛徽章:
0
5 [报告]
发表于 2003-06-02 19:08 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

原帖由 "king2k" 发表:
1.怎样限制单个IP连接数?
2.怎样限制速度、流量?
3.怎样限制空间(上传空间)?
4.怎样设置虚拟目录和虚拟主机?

请手们来问答,最好详细些,我是小菜鸟!^○^
   
我不是要那些,我只想要上面几个答复!我的配置文件如下:


# 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                        "roFTPD Default Installation"
ServerType                        standalone
DefaultServer                        on
RequireValidShell                off

<Global>;
# SQLAuthoritative on
SQLConnectInfo proftp proftp ftppass
SQLAuthTypes Backend
SQLUserInfo users userid passwd uid gid homedir NULL
RequireValidShell                off
SQLAuthenticate users* groups* usersetfast groupsetfast
SQLHomedirOnDemand on
SQLMinUserGID 500
SQLMinUserUID 500
# SQLHomedir /home/userdir
</Global>;


# Port 21 is the standard FTP port.
Port                                21

# 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                                nobody

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#DefaultRoot ~

# Normally, we want files to be overwriteable.
<Directory />;
  AllowOverwrite                on
</Directory>;

# 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
  DisplayFirstChdir                .message

  # Limit WRITE everywhere in the anonymous chroot
  <Limit WRITE>;
    DenyAll
  </Limit>;
</Anonymous>;

应该怎样设~!!

论坛徽章:
0
6 [报告]
发表于 2003-06-02 19:35 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

DING!

论坛徽章:
0
7 [报告]
发表于 2003-06-03 08:13 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

冇人会吗?

论坛徽章:
0
8 [报告]
发表于 2003-06-03 13:36 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

原帖由 "king2k" 发表:
1.怎样限制单个IP连接数?
2.怎样限制速度、流量?
3.怎样限制空间(上传空间)?
4.怎样设置虚拟目录和虚拟主机?

请手们来问答,最好详细些,我是小菜鸟!^○^
   

版主会吗?

论坛徽章:
0
9 [报告]
发表于 2003-06-03 14:08 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

再DING!

论坛徽章:
0
10 [报告]
发表于 2003-06-03 18:47 |只看该作者

proftp+mysql配置FTP服务器~!~有些难想请问高手们~!~

原帖由 "king2k" 发表:
1.怎样限制单个IP连接数?
2.怎样限制速度、流量?
3.怎样限制空间(上传空间)?
4.怎样设置虚拟目录和虚拟主机?

请手们来问答,最好详细些,我是小菜鸟!^○^
   

真的冇人会吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP