LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1488|回复: 11

debian下设置FTP服务器

[复制链接]
发表于 2007-11-20 11:18:38 | 显示全部楼层 |阅读模式
我在debian下安装了一个FTP服务器proftp,但是总不能通过匿名访问,proftpd.conf配置如下
#
# /etc/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes reload proftpd after modifications.
#
Include /etc/proftpd/modules.conf
UseIPv6                         off

ServerName                        "0.0.0.0"
ServerType                        standalone
DeferWelcome                        on

MultilineRFC2228                on
DefaultServer                        on
ShowSymlinks                        on

TimeoutNoTransfer                600
TimeoutStalled                        600
TimeoutIdle                        1200

TransferRate                        RETR 100

DisplayLogin                    welcome.msg
DisplayFirstChdir               .message
ListOptions                        "-l"

DenyFilter                        \*.*/

#MaxHostsPerUser                1
#MaxClientsPerUser                2
MaxClientsPerHost                2

ServerIdent                        off
# Uncomment this if you are using NIS or LDAP to retrieve passwords:
#PersistentPasswd                off

# Uncomment this if you would use TLS module:
#TLSEngine                         on

# Uncomment this if you would use quota module:

QuotaEngine                        on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
QuotaLog "/var/log/quota.log"

SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM quotalimits WHERE name = '%{0}'AND quota_type = '%{1}'"

SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM quotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"

SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" quotatallies

SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" quotatallies

QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

# Uncomment this if you would use ratio module:
#Ratios                                on

# Port 21 is the standard FTP port.
Port                                21

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

# Set the user and group that the server normally runs at.
User                                nobody
Group                                nogroup

# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
#Umask                                022  022
Umask                                133  133
# Normally, we want files to be overwriteable.
AllowOverwrite                        on

AllowRetrieveRestart                on
AllowStoreRestart                on

# Delay engine reduces impact of the so-called Timing Attack described in
# http://security.lss.hr/index.php ... p;ID=LSS-2004-10-02
# It is on by default.
#DelayEngine                         off

# A basic anonymous configuration, no upload directories.

<Anonymous /home/ftp/public>
   User                                ftp
   Group                        upload
#   # We want clients to be able to login with "anonymous" as well as "ftp"
   UserAlias                        anonymous ftp
#   # Cosmetic changes, all files belongs to ftp user
   DirFakeUser        on ftp
   DirFakeGroup on ftp
#
   RequireValidShell                off
#
#   # Limit the maximum number of anonymous logins
   MaxClients                        100
#
#   # 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
   <Directory *>
     <Limit WRITE>
       DenyAll
     </Limit>
   </Directory>
#
#   # Uncomment this if you're brave.
#    <Directory incoming>
#      # Umask 022 is a good standard umask to prevent new files and dirs
#   #   # (second parm) from being group and world writable.
#      Umask                                022  022
#               <Limit READ WRITE>
#     #          DenyAll
#     #          </Limit>
#               <Limit STOR>
#               Allow 10.216.83.
#               </Limit>
#    </Directory>


#
</Anonymous>

DefaultRoot ~ ftp
SyslogLevel emerg
SystemLog /var/log/proftpd/proftpd.log

SQLAuthTypes plaintext Crypt
SQLAuthenticate users* groups*
SQLConnectInfo ftpdb@localhost proftpd whosname
SQLUserInfo ftpuser userid passwd uid gid homedir shell
SQLGroupInfo ftpgroup groupname gid members
SQLMinID 500
SQLHomedirOnDemand on
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() where userid='%u'" ftpuser
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() where userid='%u'" ftpuser
DeferWelcome on
RootLogin off
RequireValidShell off
发表于 2007-11-20 12:25:29 | 显示全部楼层
使用vsftpd吧,不用配置就可匿名访问的,配置起来也很简单
回复 支持 反对

使用道具 举报

发表于 2007-11-20 12:45:15 | 显示全部楼层
楼主在登录的时候有什么错误提示么
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-11-20 14:13:23 | 显示全部楼层
提示:
FTP文件夹错误
WINDOWS无法访问文件夹,请确保输入的文件名是正确的,并且你有权访问此文件夹。

详细信息:
终止FTP会话
回复 支持 反对

使用道具 举报

发表于 2007-11-20 21:59:53 | 显示全部楼层
在 windows 中的话就打开 cmd.exe, 在其中用 ftp 命令手工登录, 看看服务器直接返回的错误信息是什么
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-11-20 22:52:20 | 显示全部楼层
在命令行下进行连接,提示:连接被拒绝
回复 支持 反对

使用道具 举报

发表于 2007-11-21 12:06:45 | 显示全部楼层
看看 server 端的防火墙是否开放了 ftp 的端口
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-11-21 15:51:45 | 显示全部楼层
这个是肯定开放的,因为之前还是能用的,就在升级PHP之后就这样了,但是我看了PHP的配置没有关于FTP的

这是什么原因呢?
回复 支持 反对

使用道具 举报

发表于 2007-11-22 09:01:38 | 显示全部楼层
服务器端的提示是 "连接被拒绝" 的话个人认为还是首先确认 ftp server 正常启动, 比如在 server 的机器上本地登录一下试试; 另外要保证端口的开放性, 作为一个测试, 关闭防火墙, 再远程连接一次试试. 有时候问题就是出在这些平时认为绝对不会出错的地方, 试一试没坏处

另外楼主用的是什么发行版, 如果是像 debian 这样的, 那么如果从源内更新 php 的话说不定会依赖性地更新其它某些包从而影响了 ftp server
回复 支持 反对

使用道具 举报

发表于 2007-11-22 21:22:51 | 显示全部楼层
建议你打开proftpd的调试选项:
cat /etc/default/proftpd
# Defaults for proftpd initscript

# Master system-wide proftpd switch. The initscript
# will not run if it is not set to yes.
RUN="yes"

# Default options.
# For more exhaustive logging, try "-d 3".
OPTIONS=""

将options这一行的引号中加入 -d 3 ,重启proftpd,再次登录ftp,查看日志,即可找出原因。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表