Use MySQL to enable virtual user access to the vsftpd Server

Source: Internet
Author: User
Tags crypt

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.