LinuxSir.cn,穿越时空的Linuxsir!

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

大家看看我的错误在哪?

[复制链接]
发表于 2004-3-12 11:59:11 | 显示全部楼层 |阅读模式
我的 proftpd.conf 的配置
# Port 21 is the standard FTP port.
Port                            21
                                                                                
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and 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.  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                    30
# Set the user and group under which the server will run.
User                            ftpuser
Group                           ftpgroup
                                                                                
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
                                                                                
# Normally, we want files to be overwriteable.
<Directory />
  AllowOverwrite                on
</Directory>
                                                                                
# A basic anonymous configuration, no upload directories.  If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
#########################################################################
#                                                                       #
                                                                                
# Uncomment lines with only one # to allow basic anonymous access       #
#                                                                       #
#########################################################################
                                                                                
#<Anonymous /usr/home/sjssun>
#  User                                sjssun
  # Group                               wheel
                                                                                
  ### We want clients to be able to login with "anonymous" as well as "ftp"
  # UserAlias                   anonymous ftp
                                                                                
  ### Limit the maximum number of anonymous logins
   MaxClients                   10
                                                                                
  ### 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
#   <Limit WRITE>
#    DenyAll
  # </Limit>
#</Anonymous>
DefaultRoot ~
SQLAuthTypes Backend Plaintext
#SQLAuthTypes Plaintext Crypt
SQLAuthenticate users* groups*
SQLConnectInfo ftpdb@localhost proftpd password
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='%uSQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
DeferWelcome on
RootLogin off
RequireValidShell off
 楼主| 发表于 2004-3-12 12:02:44 | 显示全部楼层

我的数据库结构是这样的

+----+---------+-----------+------+------+---------+----------+-------+---------------------+---------------------+
| id | userid  | passwd    | uid  | gid  | homedir | shell    | count | accessed            | modified            |
+----+---------+-----------+------+------+---------+----------+-------+---------------------+---------------------+
|  1 | ftpuser | ftppasswd | 5501 | 5500 | /tony   | /bin/csh |     0 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
+----+---------+-----------+------+------+---------+----------+-------+---------------------+---------------------+




mysql> select * from ftpgroup;
+-----------+------+---------+
| groupname | gid  | members |
+-----------+------+---------+
| ftpgroup  | 5500 | ftpuser |
+-----------+------+---------+
# id ftpuser  结果是
uid=5501(ftpuser) gid=5500(ftpgroup) groups=5500(ftpgroup)
ftpgroup也已经建立了

但是 用 ftpuser 和 ftppasswd 无法登陆
大家看看是怎么回事
发表于 2004-3-12 15:18:32 | 显示全部楼层

这是我的配置文件,你可以看看,我的成功了 。

ServerName                      "roFTPD Default Installation"
ServerType                      standalone
DefaultServer                   on

ServerIdent                     off

ScoreboardFile                   /var/run/proftpd.scoreboard

# Port 21 is the standard FTP port.
Port                            21

Umask                           022

MaxInstances                    30

# Set the user and group under which the server will run.
User                            ftp
Group                           ftp

# Normally, we want files to be overwriteable.
<Directory />
  AllowOverwrite                on
</Directory>

RequireValidShell               off
AllowOverwrite                  no

<Anonymous /home/ftp/anonymous>
   User                                 ftp
   Group                                ftp

  ### We want clients to be able to login with "anonymous" as well as "ftp"
   UserAlias                    anonymous ftp

  ### Limit the maximum number of anonymous logins
   MaxClients                   10

  ### 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
  # <Limit WRITE>
  #   DenyAll
  # </Limit>
</Anonymous>

DefaultRoot ~ ftpuser
DefaultRoot ~ ftpgroup

SQLAuthTypes Backend Plaintext
SQLAuthenticate users groups usersetfast groupsetfast

# databasename@host database_user user_password
SQLConnectInfo ftpdb@localhost proftpd mysql-passwd**
SQLUserInfo ftpuser userid passwd uid gid homedir shell
SQLGroupInfo ftpgroup groupname gid members
SQLHomedirOnDemand on
# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid='%u'" users
# Update modified everytime user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" users

###################################

最后要注意的是你添加进入数据库的homedir 项应该是一个已经存在的目录。
 楼主| 发表于 2004-3-12 15:41:52 | 显示全部楼层
我的和你的没有什么区别啊

为什么我的不行?
发表于 2004-3-12 16:00:06 | 显示全部楼层

主要是在这里

在mysql里面添加用户的时候,homedir项应该是已经存在的。
 楼主| 发表于 2004-3-12 16:06:31 | 显示全部楼层
你有没有试过在 数据库中插入其他用户看看 能不能登陆

你用的  ftpuser用户是系统用户,,看看添加别的可以不
发表于 2004-3-12 16:20:57 | 显示全部楼层

还有一点,那个homedir的权限要给系统的ftp用户

然后就可以了。
 楼主| 发表于 2004-3-12 16:24:42 | 显示全部楼层
你开始的时候也是验证错误,,你的问题是错在哪儿?

假如说我的是 ftpuser 
有一个 /tony 目录
只要 chown ftpuser /tony 就可以了吗
发表于 2004-3-12 16:37:43 | 显示全部楼层

看看这个

首先,你使用mysql虚拟用户登入系统,其实是影射成了系统的一个真实用户,一般是ftp,主要看表:
#######################################
CREATE TABLE `ftpuser` (
`id` int(10) unsigned NOT NULL auto_increment,
`userid` varchar(32) NOT NULL default '',
`passwd` varchar(32) NOT NULL default '',
`uid` smallint(6) NOT NULL default '5500',
`gid` smallint(6) NOT NULL default '5500',
`homedir` varchar(255) NOT NULL default '',
`shell` varchar(16) NOT NULL default '/sbin/nologin',
`count` int(11) NOT NULL default '0',
`accessed` datetime NOT NULL default '0000-00-00 00:00:00',
`modified` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
##########################################
里面的uid和gid的值对应的系统的哪个用户。我们就以ftp为例。
这样说来,你登陆近来的homedir应该就是对于ftp用户来说,用读,写,执行权限的目录,所以最好是/home/ftp的下层目录。如果是其他的,要确保权限正确。否则的话,登陆回提示验证失败。
如果proftpd启动有问题,看看proftpd.conf文件里面是否有
ScoreboardFile                         /var/run/proftpd.scoreboard
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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