<b>Freebsd4.9 + VSFTPD + MySQL 配置实例</b>[服务器安全]
本文“<b>Freebsd4.9 + VSFTPD + MySQL 配置实例</b>[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
安装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
#pw useradd
nobody
#mkdir /usr/share/empty/
#mkdir /var/ftp/
#pw useradd ftp -d
/var/ftp
#chown root /var/ftp
#chgrp wheel /var/ftp
#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
vsftpd
auth required pam_mysql.so user=vsftpdguest passwd=vsftpdguest
\
host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=passwd
crypt=2
vsftpd 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