教你在Gentoo中配置FTP(proftpd)服务器

发布时间:2020-12-13编辑:脚本学堂
教你在Gentoo中配置FTP服务器(proftpd),有需要的朋友可以看看。

教你在Gentoo中配置FTP服务器proftpd),有需要的朋友可以看看。

主机环境:Gentoo 11.2
内核版本:linux Kernel 3.2.1

这里选择proftpd作为FTP服务器

1、安装proftpd
emerge -av proftpd

2、配置proftpd
首先,复制/etc/proftpd/proftpd.conf.sample
cp /etc/proftpd/proftpd.conf.sample /etc/proftpd/proftpd.conf

然后,打开该文件进行适当的修改。以下是我的文件:
   

复制代码 代码如下:
ServerName "yan's ftp server!" 
    ServerType standalone 
    DefaultServer on 
    requireValidshell off 
    AuthPAM on 
    AuthPAMConfig ftp 
    RequireValidShell off 
     
    # Listen on the standard FTP port 21. 
    Port 21 
     
    # New directories and files should not be group or 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. 
    MaxInstances 30 
     
    # The server will run under ftp/ftp. 
    User ftp 
    Group ftp 
     
    # Every FTP sessions is "jailed" into the user's home directory. 
    DefaultRoot ~ 
     
    # Generally files are overwritable. 
    AllowOverwrite on 
     
    # Disallow the use of the SITE CHMOD command. 
    <Limit SITE_CHMOD> 
      DenyAll 
    </Limit> 
    SystemLog                       /var/log/proftpd.syslog 
    TransferLog                     /var/log/proftpd.transferlog 
     
    # A basic anonymous FTP account without an upload directory. 
    <Anonymous /home/ftp> 
      User ftp 
    Group ftp 
     
    # Every FTP sessions is "jailed" into the user's home directory. 
    DefaultRoot ~ 
     
    # Generally files are overwritable. 
    AllowOverwrite on 
     
    # Disallow the use of the SITE CHMOD command. 
    <Limit SITE_CHMOD> 
      DenyAll 
    </Limit> 
    SystemLog                       /var/log/proftpd.syslog 
    TransferLog                     /var/log/proftpd.transferlog 
     
    # A basic anonymous FTP account without an upload directory. 
    <Anonymous /home/ftp> 
      User ftp 
      Group ftp 
     
      # Clients can login with the username "anonymous" and "ftp". 
      Useralias anonymous ftp 
     
      # Limit the maximum number of parallel anonymous logins to 10. 
      MaxClients 10 
     
      # Prohibit the WRITE command for the anonymous users. 
      <Limit WRITE> 
        DenyAll 
      </Limit> 
      <Limit LOGIN> 
        Order               deny,allow 
        Allow               from all 
      </Limit> 
    </Anonymous> 

3、启动服务
/etc/proftpd/proftpd start

如果正常这样默认的FTP配置的服务器就搭建好了。

遇到一个问题:ftp用户登录时总是失败,相关日志:
Mar 16 12:05:46 yan-laptop proftpd[15868] yan-laptop: ProFTPD 1.3.3g (maint) (built Fri Mar 16 2012 10:36:06 CST) standalone mode STARTUP
Mar 16 12:05:46 yan-laptop proftpd[15819] yan-laptop (yan-laptop[::ffff:127.0.0.1]): FTP session closed.
Mar 16 12:05:52 yan-laptop proftpd[15877] yan-laptop (yan-laptop[::ffff:127.0.0.1]): FTP session opened.
Mar 16 12:05:57 yan-laptop proftpd[15877] yan-laptop (yan-laptop[::ffff:127.0.0.1]): ftp: Directory /home/ftp/ is not accessible.
Mar 16 12:07:39 yan-laptop proftpd[15877] yan-laptop (yan-laptop[::ffff:127.0.0.1]): FTP session closed.
Mar 16 12:11:00 yan-laptop proftpd[15868] yan-laptop: ProFTPD killed (signal 15)
Mar 16 12:11:00 yan-laptop proftpd[15868] yan-laptop: ProFTPD 1.3.3g standalone mode SHUTDOWN

解决方法:
去掉aclUSE标记,重新编译proftpd安装
USE="-acl" emerge proftpd
重启服务,问题解决。

本文转自:http://blog.csdn.net/yming0221/article/details/7360370