如果您要使用 MySQL 进行虚拟使用者的身份认证,编译时请加上 --with-mysql 的选项。
./configure --with-mysql
make
make install
配置文件非常簡單….
在smbftpd.conf下 把這三個的註記拿掉
VirtualUserMapping mysql
VirtualUserAuthMethod mysql
VirtualUserAuthConfig /usr/local/etc/smbftpd/smbftpd_mysql.conf
ChrootSet @ ~
再去編輯/usr/local/etc/smbftpd/smbftpd_mysql.conf
Server 127.0.0.1
Port 3306
Socket /tmp/mysql.sock
User root
Password rootpw
database ftp_users
Crypt crypt
SQLGetPassword SELECT password FROM user_table WHERE name='%U'
SQLGetHome SELECT home FROM user_table WHERE name='%U'
SQLGetGroup SELECT group_name FROM user_table WHERE name='%U' =======================================================================
数据库为 ftp_users
# The following SQL is used to get virtual user's information.
#
# CREATE TABLE user_table( # name varchar(64),
# password varchar(64),
# group_name varchar(64),
# home varchar(256)
# );
# 建立完用户表之后,就可以添加虚拟用户啦 ,
exp: insert into user_table(name, password, group_name, home) values('aaa', 'aaa', 'mysql', '/home/aaa'); mkdir /home/aaa chown mysql:mysql /home/aaa
以后在添加用户时,像上面一样,为其添加目录既可
然后就可以重新启动smbftpd 让配置文件生效了
/usr/local/etc/rc.d/smbftpd.sh restart
就可以用虚拟用户登陆啦,嘿嘿:)