- # yum install vsftpd –y
- # yum install mod_ssl -y
- dir = /etc/pki/CA
- # mkdir certs newcerts crl
- # touch index.txt
- # echo 01 > serial
- # (umask 077;openssl genrsa -out private/cakey.pem 2048)
- # openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3650
- # mkdir /etc/vsftpd/ssl
- # cd /etc/vsftpd/ssl
- # (umask 077;openssl genrsa -out vsftpd.key 2048)
- # openssl req -new -key vsftpd.key -out vsftpd.csr
- # openssl ca -in vsftpd.csr -out vsftpd.crt
- ssl_enable=YES ----启用ssl功能
- ssl_sslv3=YES ----支持sslv3协议
- ssl_tlsv1=YES ----支持tlsv1协议
- allow_anon_ssl=NO ----匿名用户不启用ssl加密访问
- force_local_data_ssl=YES ----强制本地用户文件传输使用ssl
- force_local_logins_ssl=YES ----强制本地用户登陆需ssl认证
- rsa_cert_file=/etc/vsftpd/ssl/vsftpd.crt -----vsftpd服务器证书文件路径
- rsa_private_key_file=/etc/vsftpd/ssl/vsftpd.key ----vsftpd服务器自身密钥文件路径
- # yum install mysql-server mysql-devel -y
- # tar xf pam_mysql-0.7RC1.tar.gz
- # cd pam_mysql-0.7RC1
- # ./configure --with-mysql=/usr --with-openssl
- # make
- # make install
- mysql> create database vsftpd;
- mysql> use vsftpd;
- mysql> CREATE TABLE users (
- -> id SMALLINT AUTO_INCREMENT NOT NULL,
- -> name CHAR(20) BINARY NOT NULL,
- -> password CHAR(48) BINARY NOT NULL,
- -> PRIMARY key(id));
- mysql> GRANT SELECT ON vsftpd.* TO vsftpd@localhost IDENTIFIED BY 'vsftpd';
- mysql> GRANT SELECT ON vsftpd.* TO [email protected] IDENTIFIED BY 'vsftpd';
- mysql> INSERT INTO users (name,password) VALUE ('test','test'),('test1','test1');
- mysql> FLUSH PRIVILEGES;
- # vim /etc/pam.d/vsftpd.mysql
- auth required /lib/security/pam_mysql.so user=vsftpd passwd=vsftpd host=localhost db=vsftpd tables=users usercolumn=name passwdcolumn=passwd crypt=0
- account required /lib/security/pam_mysql.so user=vsftpd passwd=vsftpd host=localhost db=vsftpd tables=users usercolumn=name passwdcolumn=passwd crypt=0
- # usradd –s /sbin/nologin –d /var/ftproot vuser
- # chmod go+rx /var/ftproot/
- anonymous_enable=YES
- local_enable=YES
- write_enable=YES
- anon_upload_enable=YES
- anon_mkdir_write_enable=YES
- guest_enable=YES -----启用来宾账户访问
- guest_username=vuser ------指定虚拟用户访问时映射的本地用户
- pam_service_name=vsftpd.mysql
- # service vsftpd restart
- user_config_dir=/etc/vsftpd/vuser ----指定虚拟用户配置文件目录
- # mkdir /etc/vsftpd/vuser
- # cd /etc/vsftpd/vuser
- # touch test test1 ---创建与虚拟用户同名的配置文件
- anon_upload_enable=NO
- anon_upload_enable=YES