Proftpd的配置

运维 系统运维
Proftpd的配置:ProFTPD目标是实现一个安全且易于设定的FTP Server,Proftpd不仅针对Wu-Ftp改进了许多问题,而且还有许多新的功能。那么该如何配置Proftpd?本文将一一简述。Proftpd的配置:

  Proftpd配置:ProFTPD设计目标是实现一个安全且易于设定的FTP Server。

  目前Unix或类Unix平台上 FTP Server十分有限,最常使用的恐怕就是wu-ftpd了。虽然wu-ftpd有着极佳的效能同时也是一套很好的软件,然而它却欠缺了许多Win32平台上FTP Server的一些特色,同时wu-ftpd过去也有不少的安全漏洞陆续被发现。

  ProFTPD的原创者本身就曾经花非常多的时间寻找wu-ftpd 的漏洞加以改进并且增加许多功能。然而十分不幸的是,他很快地发现显然wu-ftpd需要全部重新的改写才能补足欠缺的设定能力以及缺乏的一些功能。

  ProFTPD不是从其它FTP Server的既有原始码修改而产生的,相反的,它是完全独立而完整、重新改写的FTP Server。

  主要特色:

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

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

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

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

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

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

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

  日志以及 utmp/wtmp 支持

  Shadow 口令支持

  一、软件下载

  proftpd-1.3.0rc3.tar.gz

  二、解压缩、编译安装

  # 解压缩

  1.   [root@localhost /]# tar zvxf proftpd-1.3.0rc3.tar.gz  
  2.  
  3.   [root@localhost /]#cd proftpd-1.3.0rc3  
  4.  
  5.   #编译安装(安装到/usr/local/proftpd目录下,可随意改变此目录)  
  6.  
  7.   [root@localhost proftpd-1.3.0rc3]# ./configure --prefix=/usr/local/proftpd  
  8.  
  9.   [root@localhost proftpd-1.3.0rc3]# make  
  10.  
  11.   [root@localhost proftpd-1.3.0rc3]# make install  
  12.  

#p#

  三、建立FTP用户及相关权限(此处可根据实际需要配置)

  1、建立用户组及用户

  1.   [root@localhost /]# groupadd ftpusers # 增加一个ftpusers组  
  2.  
  3.   [root@localhost /]# useradd -d /tools -g ftpusers -s /sbin/nologin softsoul  
  4.  
  5.   # 在ftpusers组增加一个名为softsoul的用户,目录设定为/tools,软件上传专用  
  6.  
  7.   [root@localhost /]# useradd -d /var/www/html -g ftpusers -s /sbin/nologin websoul # 在ftpusers组增加一个名为websoul的用户,目录设定为/var/www/html,WEB server专用  
  8.  

  2、建立上传目录

  1.   # 如果你已经配置好WEB server,/var/www/html目录已经存在,只需如下修改目录权限(也可以在GUI界面下操作)  
  2.  
  3.   [root@localhost /]# chgrp -R ftpusers /var/www/html # 把wwwroot的归属组改为 ftpusers 组  
  4.  
  5.   [root@localhost /]# chmod -R 775 /var/www/html # 设置权限,ftpusers组对该文件夹具有读写执行的权限,其他用户只有读、执行权限(不可没有执行权限,否则web浏览不了)  
  6.  
  7.   [root@localhost /]# mkdir tools #在根目录下建立tools目录,作为软件目录  
  8.  
  9.   [root@localhost /]# chgrp -R ftpusers tools # 把tools的归属组也改为 ftpusers 组  
  10.  
  11.   [root@localhost /]# chmod -R 775 /tools # 设置权限  
  12.  

#p#

  四、FTP server配置

  1.   # 如果是和偶一样的菜鸟,建议在GUI界面下用gedit打开/usr/local/proftpd/etc/proftpd.conf进行配置,配置之前建议做好备份  
  2.  
  3.   [root@localhost /]# vi /usr/local/proftpd/etc/proftpd.conf  
  4.  
  5.   # 以下是偶的proftpd.conf配置内容  
  6.  
  7.   # This is a basic ProFTPD configuration file (rename it to  
  8.  
  9.   # 'proftpd.conf' for actual use. It establishes a single server  
  10.  
  11.   # and a single anonymous login. It assumes that you have a user/group  
  12.  
  13.   # "nobody" and "ftp" for normal operation and anon.  
  14.  
  15.   ServerName "Soul's FTP Server"  
  16.  
  17.   ServerType standalone  
  18.  
  19.   DefaultServer on  
  20.  
  21.   # Port 21 is the standard FTP port.  
  22.  
  23.   Port 21  
  24.  
  25.   # Umask 022 is a good standard umask to prevent new dirs and files  
  26.  
  27.   # from being group and world writable.  
  28.  
  29.   Umask 022  
  30.  
  31.   # To prevent DoS attacks, set the maximum number of child processes  
  32.  
  33.   # to 30. If you need to allow more than 30 concurrent connections  
  34.  
  35.   # at once, simply increase this value. Note that this ONLY works  
  36.  
  37.   # in standalone mode, in inetd mode you should use an inetd server  
  38.  
  39.   # that allows you to limit maximum number of processes per service  
  40.  
  41.   # (such as xinetd).  
  42.  
  43.   MaxInstances 30 # 最多有30个proftpd的PID  
  44.  
  45.   MaxHostsPerUser 1 "Sorry, you may not connect more than one time" # 每个IP只允许一个连接  
  46.  
  47.   MaxClientsPerUser 1 "Only one such user at a time" # 每个帐户在每个客户端最多可以同时登陆1次  
  48.  
  49.   MaxClientsPerHost 1 "Sorry, you may not connect more than one time" # 同一个客户端只能最多1个帐号可以登陆  
  50.  
  51.   # Set the user and group under which the server will run.  
  52.  
  53.   User nobody  
  54.  
  55.   Group nobody  
  56.  
  57.   # To cause every FTP user to be "jailed" (chrooted) into their home  
  58.  
  59.   # directory, uncomment this line.  
  60.  
  61.   DefaultRoot ~ ftpuser # 限制ftpusers组的用户在自己的目录下  
  62.  
  63.   # Normally, we want files to be overwriteable.  
  64.  
  65.   AllowOverwrite on # 是否允许覆盖  
  66.  
  67.   # Bar use of SITE CHMOD by default  
  68.  
  69.   DenyAll  
  70.  
  71.   # 设置只有ftpusers组的用户可以ftp登录  
  72.  
  73.   DenyALL  
  74.  
  75.   AllowGroup ftpuser  
  76.  
  77.   # 设置帐号websoul拥有/var/www/html目录的所有权限  
  78.  
  79.   AllowUser websoul  
  80.  
  81.   # 设置帐号softsoul拥有/tools目录的所有权限  
  82.  
  83.   AllowUser softsoul  
  84.  
  85.   # Limit the maximum number of anonymous logins  
  86.  
  87.   MaxClients 10 # 最多允许10个用户在线  
  88.  
  89.   # We want 'welcome.msg' displayed at login, and '.message' displayed  
  90.  
  91.   # in each newly chdired directory.  
  92.  
  93.   DisplayLogin welcome.msg # 当使用者登录时,则会显示 welcome.msg 中的欢迎词信息  
  94.  
  95.   DisplayFirstChdir .message # 当使用者转换目录,则会显示 .message 中的信息  
  96.  
  97.   ##(上面的欢迎信息我测试后好象不成功,郁闷中,,,,,)  
  98.  
  99.   ServerIdent off # 屏蔽服务器版本信息  
  100.  
  101.   MaxLoginAttempts 3 # 最大连接次数  
  102.  
  103.   WtmpLog on # 是否要把ftp记录在日志中,如果不想可以设置成off屏蔽掉log日志。  
  104.  
  105.   TimeoutIdle 600 # 客户端idel时间设置,默认就是600秒  
  106.  
  107.   AllowRetrieveRestart on # 下载时,允许断点续传(默认已有,可不设置)  
  108.  
  109.   AllowStoreRestart on # 上传时,允许断点续传  
  110.  
  111.   # 让proftp支持现在流行的FXP传输方式,默认是不支持的。  
  112.  
  113.   AllowForeignAddress on  
  114.  
  115.   PassivePorts 49152 65534 # 端口也可自己指定喜欢的  
  116.  
  117.   # 下面是关于匿名用户的相关配置,根据需要自己设定,因为我不需要匿名用户登录,所以全部屏敝掉了  
  118.  
  119.   # A basic anonymous configuration, no upload directories. If you do not  
  120.  
  121.   # want anonymous users, simply delete this entire section.  
  122.  
  123.   #  
  124.  
  125.   # User ftp  
  126.  
  127.   # Group ftp  
  128.  
  129.   # We want clients to be able to login with "anonymous" as well as "ftp"  
  130.  
  131.   # UserAlias anonymous ftp  
  132.  
  133.   # Limit the maximum number of anonymous logins  
  134.  
  135.   # MaxClients 10  
  136.  
  137.   # We want 'welcome.msg' displayed at login, and '.message' displayed  
  138.  
  139.   # in each newly chdired directory.  
  140.  
  141.   # DisplayLogin welcome.msg  
  142.  
  143.   # DisplayFirstChdir .message  
  144.  
  145.   # Limit WRITE everywhere in the anonymous chroot  
  146.  
  147.   #  
  148.  
  149.   # DenyAll  
  150.  
  151.   #  
  152.  
  153.   #  
  154.  

#p#

  五、开机自动运行proftpd

  1.   # 若需要将proftpd设置为系统启动时自动启动则通过如下命令拷贝启动文件:  
  2.  
  3.   [root@proftpd-1.3.0rc3]# cp ./contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd  
  4.  
  5.   # 修改该脚本的可执行属性:  
  6.  
  7.   [root@localhost /]# chmod +x /etc/rc.d/init.d/proftpd  
  8.  

  **********以下内容,大家可以参考****************************

  然后编辑/etc/rc.d/init.d/functions:

  修改

  1.   export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" 
  2.  

  为

  1.   export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin" 
  2.  

  注:若将在运行./cofigure命令时通过--prefix选项指定将proftpd安装在/usr/sbin目录下则不需要修改fuctions文件。

  ***************************************************************************

  ====这段内容是根据自己的实际情况修改的内容,与上面一段二者选一,大家试一下吧===

  编辑/etc/rc.d/init.d/proftpd

  修改

  1.   PATH="$PATH:/usr/local/sbin" 
  2.  

  为

  1.   PATH="$PATH:/usr/local/proftpd/sbin" 
  2.  

  ======================================================================================

  1.   # 然后运行命令:  
  2.  
  3.   [root@localhost /]# chkconfig --level 35 proftpd on  
  4.  
  5.   # 则下次系统启动以后,proftpd将自动启动。  
  6.  
  7.   # 通过如下命令启动proftpd:  
  8.  
  9.   [root@ftpd /]# /etc/rc.d/init.d/proftpd start  
  10.  
  11.   这时候可以通过如下命令来测试proftpd是否正常运行:  
  12.  
  13.   [root@homeserver usr]# ftp 192.168.1.20  
  14.  
  15.   Connected to 192.168.1.20.  
  16.  
  17.   220 192.168.1.20 FTP server ready  
  18.  
  19.   500 AUTH not understood  
  20.  
  21.   500 AUTH not understood  
  22.  
  23.   KERBEROS_V4 rejected as an authentication type  
  24.  
  25.   Name (192.168.1.20:phoebus): softsoul  
  26.  
  27.   331 Password required for softsoul.  
  28.  
  29.   Password:  
  30.  
  31.   230 User softsoul logged in.  
  32.  
  33.   Remote system type is UNIX.  
  34.  
  35.   Using binary mode to transfer files.  
  36.  
  37.   ftp> 

【编辑推荐】

责任编辑:zhaolei 来源: CSDN
相关推荐

2011-02-22 10:08:46

ProFTPD配置

2011-02-22 14:50:53

ProFTPD

2011-02-24 13:15:59

2011-02-25 16:39:34

proftpd配置文件

2011-02-23 11:15:21

DebianProFTPd

2011-02-25 12:30:01

ProFtpd配置

2011-02-24 14:47:48

ProFTPD

2011-02-23 10:43:17

2011-03-03 10:06:13

ProftpdMysqlQuota

2011-03-03 13:16:32

Proftpd配置文件

2011-03-08 17:04:10

ProFTPDUbuntu

2011-02-22 16:24:30

2011-03-07 17:15:52

ProFTPD配置

2011-02-25 14:48:25

ProftpdMySQL

2011-02-22 17:24:32

2011-03-03 10:49:37

Linux配置Proftpd

2011-02-25 10:10:41

Proftpd

2011-03-08 16:30:40

Proftpd

2011-02-25 13:41:59

Proftpdanonymous

2011-02-24 13:42:34

点赞
收藏

51CTO技术栈公众号