Gentoo Linux下配置FTP服务器

来源:岁月联盟 编辑:exp 时间:2012-03-16

主机环境: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
打开该文件进行适当的修改
下面是我的文件
[plain]
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
重启服务后问题解决。


作者 yming0221