ubuntu下利用proftpd搭建ftp服务器

运维 系统运维
ubuntu下利用proftpd搭建ftp服务器:proftpd(Professional FTP daemon),是针对Wu-FTP的弱项而开发的。除了改进其安全性,还有具备许多Wu-FTP所没有的特点。比如,能以Stand-alone、xinetd模式运行。ProFTP不仅配置方便,而且有MySQL模块,本文主要讲述的是ubuntu下利用proftpd搭建ftp服务器。

  ubuntu下如何利用proftpd构架一个ftp服务器:proftpd(Professional FTP daemon),是针对Wu-FTP的弱项而开发的。除了改进其安全性,还有具备许多Wu-FTP所没有的特点。比如,能以Stand-alone、xinetd模式运行。ProFTP不仅配置方便,而且有MySQL模块,本文主要讲述的是ubuntu下利用proftpd搭建ftp服务器。

  这篇文章针对那些希望利用ftp协议和朋友们共享文件的人们,就像windows下的FTPserU,我提供的方式不是唯一的,希望我的方法足够清晰.这个FTPserver只允许拥有正确密码的人使用,所以你要明白只有已知的用户才能读取你的FTP服务.

  1- 使用下面的命令安装proftpd:

  1.   Code:  
  2.  
  3.   sudo apt-get install proftpd  
  4.  

  2- 在etc/shells 加入如下代码

  1. sudo gedit /etc/shells to open the file  
  2.  

  译注:命令行模式下sudo vi /etc/shells) :

  1.   Code:  
  2.  
  3.   /bin/false  
  4.  

  新建一个 /home/FTP-shared 目录 :

  1.   Code:  
  2.  
  3.   cd /home  
  4.  
  5.   sudo mkdir FTP-shared  
  6.  

  创建一个只能用来读取ftp的用户userftp. 这个用户不需要有效的shell(更安全) ,所以选择 /bin/false shell 给 userftp , /home/FTP-shared 作为主目录.

  为了是这部分更清楚,我给取此操作的命令行:

  1.   Code:  
  2.  
  3.   sudo useradd userftp -p your_password -d /home/FTP-shared -s /bin/false  
  4.  

  在FTP-shared 目录下新建一个download和一个upload 目录:

  1.   Code:  
  2.  
  3.   cd /home/FTP-shared/  
  4.  
  5.   sudo mkdir download  
  6.  
  7.   sudo mkdir upload  
  8.  

  现在我们来给它们设置相应的权限:

  1.   Code:  
  2.  
  3.   cd /home  
  4.  
  5.   sudo chmod 755 FTP-shared  
  6.  
  7.   cd FTP-shared  
  8.  
  9.   sudo chmod 755 download  
  10.  
  11.   sudo chmod 777 upload  
  12.  

  3- proftpd的配置文件:

  1.   Code:  
  2.  
  3.   sudo gedit /etc/proftpd.conf  
  4.  

  当然你可以按你的需要编辑你自己的proftpd.conf:

  Code:

  1.   # To really apply changes reload proftpd after modifications.  
  2.  
  3.   AllowOverwrite on  
  4.  
  5.   AuthAliasOnly on  
  6.  
  7.   # Choose here the user alias you want !!!!  
  8.  
  9.   UserAlias sauron userftp  
  10.  
  11.   ServerName "ChezFrodon"  
  12.  
  13.   ServerType standalone  
  14.  
  15.   DeferWelcome on  
  16.  
  17.   MultilineRFC2228 on  
  18.  
  19.   DefaultServer on  
  20.  
  21.   ShowSymlinks off  
  22.  
  23.   TimeoutNoTransfer 600  
  24.  
  25.   TimeoutStalled 100  
  26.  
  27.   TimeoutIdle 2200  
  28.  
  29.   DisplayFirstChdir .message  
  30.  
  31.   ListOptions "-l"  
  32.  
  33.   RequireValidShell off  
  34.  
  35.   TimeoutLogin 20  
  36.  
  37.   RootLogin off  
  38.  
  39.   # It's better for debug to create log files ;-)  
  40.  
  41.   ExtendedLog /var/log/ftp.log  
  42.  
  43.   TransferLog /var/log/xferlog  
  44.  
  45.   SystemLog /var/log/syslog.log  
  46.  
  47.   #DenyFilter \*.*/  
  48.  
  49.   # I don't choose to use /etc/ftpusers file (set inside the users you want to ban, not useful for me)  
  50.  
  51.   UseFtpUsers off  
  52.  
  53.   # Allow to restart a download  
  54.  
  55.   AllowStoreRestart on  
  56.  
  57.   # Port 21 is the standard FTP port, so don't use it for security reasons (choose here the port you want)  
  58.  
  59.   Port 1980  
  60.  
  61.   # To prevent DoS attacks, set the maximum number of child processes  
  62.  
  63.   # to 30. If you need to allow more than 30 concurrent connections  
  64.  
  65.   # at once, simply increase this value. Note that this ONLY works  
  66.  
  67.   # in standalone mode, in inetd mode you should use an inetd server  
  68.  
  69.   # that allows you to limit maximum number of processes per service  
  70.  
  71.   # (such as xinetd)  
  72.  
  73.   MaxInstances 8  
  74.  
  75.   # Set the user and group that the server normally runs at.  
  76.  
  77.   User nobody  
  78.  
  79.   Group nogroup  
  80.  
  81.   # Umask 022 is a good standard umask to prevent new files and dirs  
  82.  
  83.   # (second parm) from being group and world writable.  
  84.  
  85.   Umask 022 022  
  86.  
  87.   PersistentPasswd off  
  88.  
  89.   MaxClients 8  
  90.  
  91.   MaxClientsPerHost 8  
  92.  
  93.   MaxClientsPerUser 8  
  94.  
  95.   MaxHostsPerUser 8  
  96.  
  97.   # Display a message after a successful login  
  98.  
  99.   AccessGrantMsg "welcome !!!"  
  100.  
  101.   # This message is displayed for each access good or not  
  102.  
  103.   ServerIdent on "you're at home"  
  104.  
  105.   # Set /home/FTP-shared directory as home directory  
  106.  
  107.   DefaultRoot /home/FTP-shared  
  108.  
  109.   # Lock all the users in home directory, ***** really important *****  
  110.  
  111.   DefaultRoot ~  
  112.  
  113.   MaxLoginAttempts 5  
  114.  
  115.   #VALID LOGINS  
  116.  
  117.     
  118.  
  119.   AllowUser userftp  
  120.  
  121.   DenyALL  
  122.  
  123.    
  124.     
  125.  
  126.     
  127.  
  128.   Umask 022 022  
  129.  
  130.   AllowOverwrite off  
  131.  
  132.     
  133.  
  134.   DenyAll  
  135.     
  136.  
  137.   Umask 022 022  
  138.  
  139.   AllowOverwrite off  
  140.  
  141.     
  142.  
  143.   DenyAll  
  144.  
  145.   /home/FTP-shared/upload/> 
  146.  
  147.   Umask 022 022  
  148.  
  149.   AllowOverwrite on     
  150.  
  151.   DenyAll  
  152.  
  153.   AllowAll   

  好了,你已经完成了proftpd的配置,你的服务端口是1980,而读取的参数如下,用户:sauron,密码:你为userftp设置的那个.

  4- 启动/停止/重启动你的服务:

  1.   Code:  
  2.  
  3.   sudo /etc/init.d/proftpd start  
  4.  
  5.   sudo /etc/init.d/proftpd stop  
  6.  
  7.   sudo /etc/init.d/proftpd restart  
  8.  

  对你的proftpd进行一下语法检查:

  1.   Code:  
  2.  
  3.   sudo proftpd -td5  
  4.  

  想知道谁现在连接到你的服务,用ftptop命令(使用字母"t"来转换显示频率),你也可以使用"ftpwho"命令.

【编辑推荐】

  1. 用MySQL和Proftpd配置FTP服务器
  2. ProFTPD 下的五大问题
  3. Linux ProFTPd服务器配置(全)
  4. Ubuntu vsftpd服务安装设置
  5. ProFTPD的启动与测试
  6. ubuntu下proftp的编译、安装与测试
  7. ProFTPd的启动
  8. 在图形界面下控制ProFTPD
责任编辑:zhaolei 来源: CSDN网
相关推荐

2011-02-25 16:34:01

LinuxProftpdFTP

2011-03-07 17:04:02

ProftpdFTP

2011-02-23 10:18:51

CentosProFTPD

2011-02-25 16:14:09

proftpdftp

2011-03-03 09:40:58

2009-12-08 12:23:15

UbuntuFTP服务器

2011-09-09 10:03:39

Ubuntu 11.0FTP服务器

2011-02-23 09:01:37

2011-03-03 11:15:04

UuntuPoftpdFtp

2011-02-23 12:18:28

DebianProFTPd服务器

2011-02-24 13:33:35

ProFTPDFTP

2011-10-21 07:55:28

2011-02-23 15:32:39

vsftpd

2011-02-25 16:26:17

2017-03-17 14:05:48

LinuxUbuntuFTP服务器

2011-03-03 09:04:25

2011-02-25 10:58:01

PROFTPD命令

2021-11-01 07:15:36

服务器FTPFileZilla

2011-03-03 14:47:35

2011-03-03 14:47:35

点赞
收藏

51CTO技术栈公众号