Use MySQL to enable virtual user access to the vsftpd Server
Use MySQL to enable virtual user access to the vsftpd Server
Configuration
# Install all the software packages used in this experiment
Yum-y install vsftpd mysql-server mysql-devel pam-devel gcc-c ++ make wget
# Start the mysqld service
Service mysqld start
# Initialize the database administrator password
Mysqladmin-uroot password RedHat
# Log on to the database
Mysql-uroot-predhat
# Create a vftpuser Database
Create database vftpuser;
# Access the vftpuser Database
Use vftpuser;
# Create a table for storing accounts and passwords
Create table users (name char (41), pwd char (41 ));
# Create a test user
Insert into users (name, pwd) values ('test', password ('test '));
# To ensure security, create a user dedicated to querying the users table
Grant select on vftpuser. users to vsqluser @ localhost identified by 'redhat ';
# Refresh the permission table
Flush privileges;
# Leaving the database
Quit;
# Download and install the MySQL-based PAM module
Wget http://ncu.dl.sourceforge.net/project/pam-mysql/pam-mysql/0.7RC1/pam_mysql-0.7RC1.tar.gz
Tar xzf pam_mysql-0.7RC1.tar.gz
Cd pam_mysql-0.7RC1
./Configure
Make & make install
# Modify the/etc/pam. d/vsftpd file, comment out the original content, and add the following content
Auth required/lib/security/pam_mysql.so user = vsqluser passwd = redhat host = localhost db = vftpuser table = users usercolumn = name passwdcolumn = pwd crypt = 2
Account required/lib/security/pam_mysql.so user = vsqluser passwd = redhat host = localhost db = vftpuser table = users usercolumn = name passwdcolumn = pwd crypt = 2
# Create a local user to map virtual users
Useradd-d/var/ftp/vuserdir-s/sbin/nologin vuser
# Replace the original content in the/etc/vsftpd. conf file with the following content
Listen = YES
Pam_service_name = vsftpd
Guest_enable = YES
Guest_username = vuser
Anonymous_enable = NO
Anon_world_readable_only = NO
Local_enable = YES
# Start the vsftpd service
Service vsftpd start
Four Advanced configurations of vsftpd Server:
VsFTPd configuration Tutorial:
Simple and practical Ubuntu FTP setup
Set up FTP server and Apache server on Ubuntu
Install the LAMP \ vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Simple case of anonymous uploading of SeLinux and vsftpd on the RHEL6 Platform
Install vsftpd source code in Linux
Install and configure the FTP server vsftpd in openSUSE 13.2/13.1
This article permanently updates the link address: