ProFTPD笔记二(虚拟用户)

所谓虚拟,就是说这个用户不是系统用户,而只是ProFTPD自己的私有用户。和windows中的FTP server软件serv-U中的用户很像。由于不是系统用户,使用虚拟用户可以提高安全性。

虚拟用户的信息可以从普通文件、数据库、LDAP服务器等地方获得。此处介绍最简单的一种,让ProFTPD从文件获得虚拟用户信息。

1. 在/etc/proftpd.conf中加入
RequireValidShell off
AuthOrder mod_auth_file.c
AuthUserFile /usr/local/etc/proftpd/passwd
AuthGroupFile /usr/local/etc/proftpd/group
其中,AuthOrder指定了权限检查的顺序。这里只使用虚拟用户。AuthUserFile和AuthGroupFile的文件格式看passwd(5)和group(5)。如果用户名和组名与系统的重复,看DirFakeUser和DirFakeGroup。

2. 使用ftpasswd创建passwd和group文件
$ ftpasswd --passwd --file=/usr/local/etc/proftpd/passwd --name=test1 --uid=2001 \
 --home=/home/nohome --shell=/bin/false
$ ftpasswd --passwd --file=/usr/local/etc/proftpd/passwd --name=test2 --uid=2002 \
 --home=/home/nohome --shell=/bin/false
创建了一个test1和test2用户

$ ftpasswd --group --name=test --gid=2001
创建了一个test组

$ ftpasswd --group --name=test --gid=2001 --member=test1 --member=test2
把test1和test2加入test组

3. 重启proftpd 




备注:
ftpasswd命令在proftpd的源代码包里就有,比如我的就在:
/usr/src/proftpd-1.3.1/contrib/ftpasswd
把ftpasswd改为可执行,拷贝到你可以用的任意地方就行了。

参考:
http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-Authentication.html
http://www.castaglia.org/proftpd/contrib/ftpasswd.html
http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-AuthFiles.html
http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-VirtualUsers.html

posted @ 2008-05-20 11:20  h2appy  阅读(3366)  评论(2编辑  收藏  举报