所需软件:
mysql-5.1.56.tar.gz
pam_mysql-0.7RC1.tar.gz
vsftpd-2.3.4.tar.gz
以下是具体的安装与配置步骤,没有过多的文字说明,主要是步骤,大家研读吧。
yum -y install ncurses-devel openssl-devel pam-devel
cd /home/tools
tar xvzf mysql-5.1.56.tar.gz
./configure --prefix=/usr/local/mysql --with-plugins=innobase,myisam --with-low-memory --with-big-tables --with-comment --with-charset=utf8 --with-extra-charsets=all
make
make install
groupadd -g 1000 mysql
useradd -g 1000 -u 1000 -s /sbin/nologin -d /dev/null mysql
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
chown -R mysql:mysql .
bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql.mysql var
bin/mysqld_safe --user=mysql &
PATH=$PATH:/usr/local/mysql/bin
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig -v
tar xvzf vsftpd-2.3.4.tar.gz
cd vsftpd-2.3.4
vi builddefs.h
####看看里面pam认证是否打开####
make
#mkdir -p /usr/share/empty/
#mkdir /var/ftp
#useradd -d /var/ftp/ ftp
#chown -R root.root /var/ftp/
#chmod og-w /var/ftp/
#####如果不要匿名用户,不知道这几句要加吗,时间紧,没测#####
make install
cp vsftpd.conf /etc/
tar xvzf pam_mysql-0.7RC1.tar.gz
cd pam_mysql-0.7RC1
./configure --with-mysql=/usr/local/mysql --with-ssl
很奇怪,曾经在ubuntu的机器上做过一次,不加--with-ssl的话验证没过
make
make install
useradd -d /home/vsftpd -s /sbin/nologin vsftpd
chown -R vsftpd:vsftpd /home/vsftpd/
mkdir -p /etc/vsftpd/vsftpd_user_conf
touch user1
touch user2
vi /etc/vsftpd/vsftpd_user_conf/user1
local_root=/home/vsftpd/user1
vi /etc/vsftpd/vsftpd_user_conf/user2
local_root=/home/vsftpd/user2
mkdir -p /home/vsftpd/user1
mkdir -p /home/vsftpd/user2
/usr/local/mysql/bin/mysql
mysql>create database vsftpd;
mysql>create table vsftpd.user(name char(16)binary,passwd char(16)binary);
mysql>insert into vsftpd.user (name,passwd) values ('user1','123456');
mysql>insert into vsftpd.user (name,passwd) values ('user2','123456');
mysql>grant all privileges on vsftpd.* to vsftpd@'localhost' identified by '123456';
mysql>flush privileges;
mysql>exit
cp redhat/vsftpd.pam /etc/pam.d/ftp
vi /etc/pam.d/ftp
auth required /lib/security/pam_mysql.so user=vsftpd passwd=123456 host=localhost db=vsftpd table=user usercolumn=name passwdcolumn=passwd crypt=0
account required /lib/security/pam_mysql.so user=vsftpd passwd=123456 host=localhost db=vsftpd table=user usercolumn=name passwdcolumn=passwd crypt=0
vi /etc/vsftpd.conf
###完整的vsftpd.conf文件
vi /etc/vsftpd.conf
如果遇到登录有问题的话,看看用户主目录的权限