|
Freebsd4.9+vsftpd+mysql配置实例
说明:参考了很多网上的文档
Vsftpd的虚拟用户配置:PAM + PgSQL + FreeBSD-4
http://www.cnfug.org/journal/archives/000028.html
redhat9.0+VSFTP+MySQL虚拟用户配置
http://www.linuxaid.com.cn/articles/5/6/568396619.shtml
安装freebsd4.9时请装上ports
1. 安装mysql
2. 安装pam_mysql-0.5
3. 准备数据库vsftpd
4. 安装vsftpd
5. 修改vsftpd.conf及/etc/pam.conf
6.修改/etc/pam.conf
1. 安装mysql
#mkdir /usr/local/mysql
#pw groupadd mysql
#pw useradd mysql –g mysql
#tar zxvf mysql-3.23.55.tar.gz
#cd mysql-3.23.55
#./configure --prefix=/usr/local/mysql
#make && make install
#cd scripts
#./mysql_install_db
#chown –R root /usr/local/mysql
#chown –R mysql /usr/local/mysql/var
#chgrp –R mysql /usr/local/mysql
#ee /etc/rc.local
添加/usr/local/mysql/bin/safe_mysqld --user=mysql &
起动mysql
#cd /usr/local/mysql/bin
#./safe_mysqld --user=mysql &
2. 安装pam_mysql-0.5
先装gmake
#cd /usr/ports/devel/gmake
#make install
这里有个技巧,要装mysql-4.0.16的client
#cp /home/mysql-4.0.16.tar.gz /usr/ports/distfiles
#cp /home/pam_mysql-0.5.tar.gz /usr/ports/distfiles
#cd /usr/ports/security/pam-mysql
#make install
#cp /usr/local/lib/pam_mysql.so /usr/lib
3. 准备数据库vsftpd
#cd /usr/local/mysql/bin
#./mysql –u root
> create database vsftpd ;
? use vsftpd ;
? create table users ( name char(16) binary ,passwd char(16) binary ) ;
? insert into users ( name,passwd) values (‘xiaotong’,password(‘qqmywife’);
? insert into users (name,passwd) values (‘xiaowang’,password(‘ttmywife’));
? grant select on vsftpd.users to vsftpdguest@localhost identified by ‘vsftpdguest’;
? quit ;
4. 安装vsftpd
#cd /home
#tar zxvf vsftpd-1.2.0.tar.gz
#cd vsftpd-1.2.0
#make
# cp vsftpd /usr/local/sbin/vsftpd
#cp vsftpd.conf.5 /usr/local/man/man5
#cp vsftpd.8 /usr/local/man/man8
#cp vsftpd.conf /etc
5 修改vsftpd.conf
建立系统用户vsftpdguest
#mkdir /home/vsftpdguest
#pw useradd vsftpdguest -d /home/vsftpdguest
修改vsftpd.conf
listen=YES
anonymos_enable=YES
guest_enable=YES
guest_username=vsftpdguest
pam_service_name=vsftpd
local_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
chroot_local_user=YES
6.修改/etc/pam.conf
auth required pam_mysql.so user=vsftpdguest passwd=vsftpdguest host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=passwd crypt=2
account required pam_mysql.so user=vsftpdguest passwd=vsftpdguest host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=passwd crypt=2
最后在rc.local添加vsftpd
#ee rc.local
加上/usr/local/sbin/vsftpd &
保存退出
在系统下让虚拟用户和匿名用户对目录有写权限
#chmod a+w /var/ftp
#chmod a+w /home/vsftpdguest
#reboot
作者:严炎
qq:35907960 |
|