To increase ftp mysql certification

1. Installation vsftpd, where the source may be mounted or installed yum;

2. Install mysql, skip, before the document can be viewed;

3. Installation pam-mysql, dependent pam-devel package;

[root@WebA-136 ~]#tar xf pam_mysql-0.7RC1.tar.gz
[root@WebA-136 ~]#yum install pam-devel
[root@WebA-136 ~]#./configure --with-mysql=/usr/local/mysql --with-openssl
[root@WebA-136 ~]#make && make install
[root@WebA-136 ~]#less README
[root@WebA-136 ~]#vim /etc/pam.d/vsftpd.mysql
[root@WebA-136 ~]#cat /etc/pam.d/vsftpd.mysql
[root@WebA-136 ~]#auth required /lib/security/pam_mysql.so user=vsftpd passwd=123456 host=192.168.146.136 db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=3 md5=yes
[root@WebA-136 ~]#account required /lib/security/pam_mysql.so user=vsftpd passwd=123456 host=192.168.146.136 db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=3 md5=yes

Then the configuration database

the vsftp Database Create; 
Grant selcet ON IDENTIFIED by the vsftp * [email protected] to '123456';.
Create Table
Create Table Users (
ID smallint The AUTO_INCREMENT Not null,
name char (20 is) Not binary null,
password char (48) binary Not null,
Primary Key (ID))
;
see table structure
desc users;
herein also need to insert a virtual user
iNSERT INTO users (name, password) VALUES ( 'tom', md5 (123456)), ( 'jack', md5 (123456 ));

4. Modify vsftpd.conf profile to adapt it to the authentication mysql

First, create a user

useradd -s /sbin/nologin -d /var/ftp-test vsftp
chmod go+rx /var/ftp-test

The following options are open to ensure vsftpd.conf

[Weba the root-136 @ ~] #vim /etc/vsftpd/vsftpd.conf 
anonymous_enable = YES
local_enable = YES
write_enable = YES
anon_upload_enable = NO
anon_mkdir_write_enable = NO
chroot_local_user = YES
increased following
guest_enable = YES
guest_username the vsftpd = ##### # of all virtual users must be mapped to a specified user.
= YES the listen
pam_service_name = vsftpd.mysql

Note: You can achieve different access rights depending on the set of virtual users

In the new vsftpd.conf

user_config_dir = / etc / vsftpd / test 
increased with the virtual user of the same file in / vsftpd / test directory / etc
CD / etc / vsftpd / test
Vim Tom
anon_upload_enable = YES
anon_mkdir_write_enable = YES
Vim Jack
anon_upload_enable = NO
anon_mkdir_write_enable = NO


Guess you like

Origin blog.51cto.com/12107790/2447128
FTP