VSFTPD fast configuration and MySQL authentication login

Source: Internet
Author: User
Tags crypt

VSFTPDVSFTPD is "very secure FTP daemon", security is one of its biggest features, the following look at the rapid configuration of VSFTPD.

VSFTPD Main configuration files:

/etc/pam.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf

User Category:

Anonymous users:

Anonymous default account and home directory FTP,/VAR/FTP
/var/ftp Directory properties cannot be changed
The owner group FTP of its anonymous subdirectory

Anon_upload_enable=yes Open the upload of anonymous user anon_mkdir_write_enable=yes turn on Write permission Anon_other_write_enable=yes upload file permission is 600

System users:

At least prohibit system users from accessing the FTP service,/etc/vsftpd/ftpusers,pam (/ETC/PAM.D/VSFTPD);
User account authentication requires pam_unix.so and/ETC/PASSWD related
Need to rely on system account to differentiate permissions

local_umask=022

To define the blacklist of Access users:/ETC/PAM.D/VSFTPD

Auth Required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed

Lock the user's root directory
Virtual User: Non-system user, user account is not a user account that can log into the operating system (non-/etc/passwd);

The default setting is the default path that users access through the VSFTPD service, which is the user's own home directory, and the default is to switch between all paths that have access to them;

To imprison users in their home directory; Revoke the user's read access to their home directory

Chroot_local_user=yes

Upload Download Rate:

Anon_max_rate=0 local_max_rate=0

Limit of concurrent connections:

max_clients=2000 max_per_ip=50
Configure MySQL and VSFTP authentication:

1. Install the development environment: Install the corresponding development environment first

Yum Install Mariadb-server mariadb-devel pam-devel

2. Install GCC, install the development package group directly

Yum Install "Devlopment Tools" "Server Platform Development"

3. Compile and install Pam_mysql

]# Tar xf pam_mysql-0.7rc1.tar.gz./configure--with-pam=/usr--with-mysql=/usr --with-pam-mods-dir=/usr/lib64/security/#指明模块的村饭路径 make && make install

4. Configure the vsftpd.conf file:

Pam_service_name=vsftpd.vusers #指明pam文件名 guest_enable=yes #开启来宾模式 guest_username=vuser #来宾用户

5. Write the Pam file: Readme to view

Auth required/usr/lib64/security/pam_mysql.so user=vsftpd passwd=vsftpd host=127.0.0.1 db=vsftpd table=users Usercolumn=name Passwdcolumn=password crypt=2 account required/usr/lib64/security/pam_mysql.so user=vsftpd pas SWD=VSFTPD host=127.0.0.1 db=vsftpd table=users usercolumn=name Passwdcolumn=password crypt=2

6. Create a MSYQL table:

VIM/ETC/MY.CNF [mysqld] Skip_name_resolve=on innodb_file_per_table=on log_bin =mysql-bin

Authorized User remote Login:

           GRANT ALL ON vsftpd.*   to [email protected] ' 127.0.0.1 '  IDENTIFIED BY  ' vsftpd ';            FLUSH  PRIVILEGES;            CREATE DATABASE vsftpd;            use vsftpd;            Create table users (           id int  unsigned not null auto_increment primary key ,name varchar ( ) Not null ,password char ( not null unique key) (name)             );            insert into users(               name,password)  VALUES  (' CentOS ', PASSWORD (' CentOS '), (' Redhat ', PASSWORD (' Redhat '));

7. Create a user and create a root directory, virtual user mappings

Mkdir-p/ftproot/vuser useradd-d/ftproot/vuser vuser Write permissions to the user's home directory chmod a-w/ftproot /vuser/

8. Edit the Vsftpd.conf file

Indicates the configuration file path for the virtual user user_config_dir=/etc/vsftpd/vusers_config/

9. Create a profile for each user:

Vim/etc/vsftpd/vusers_config/centos Anon_upload_enable=yes Anon_mkdir_write_enable=yes

10. Next access test for the service

This article is from the "Old Town" blog, please be sure to keep this source http://cityx.blog.51cto.com/9857477/1933939

VSFTPD fast configuration and MySQL authentication login

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.