Get the App
SLTechnology News&Howtos  ›  Servers  › 

Implement ftp to add mysql user authentication method

Shulou Source: shulou.com Published: 2022-06-03 06:27:19 09月17日 Update

This article mainly gives you a brief introduction to the implementation of ftp to increase mysql user authentication methods. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, and we will go straight to the topic. I hope that this article can bring you some practical help to achieve ftp to increase mysql user authentication methods.

1. Install vsftpd, where you can install it with yum or source code

two。 To install mysql, skip it and check the previous documentation

3. Install pam-mysql, depending on the 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

Reconfigure the database

Create database vsftp

Grant selcet on vsftp.* to vsftpd@192.168.146.136 identified by '123456'

Create a tabl

Create table users (

Id smallint auto_increment not null

Name char (20) binary not null

Password char (48) binary not null

Primary key (id))

View table structure

Desc users

Virtual users also need to be inserted here

INSERT INTO users (name,password) VALUES ('tom',md5 (123456)), (' jack',md5 (123456))

4. Modify the vsftpd.conf configuration file to make it suitable for mysql authentication

First create a user

Useradd-s / sbin/nologin-d / var/ftp-test vsftp

Chmod go+rx / var/ftp-test

Make sure the following options are turned on in vsftpd.conf

[root@WebA-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

Add the following options

Guest_enable=YES

All virtual users of guest_username=vsftpd# must be mapped to a specified user.

Listen=YES

Pam_service_name=vsftpd.mysql

Note: different access permissions can be set according to different virtual users.

Add new in vsftpd.conf

User_config_dir=/etc/vsftpd/test

Add a file with the same name as the virtual user in the / etc/vsftpd/test directory

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

To achieve ftp to increase mysql user authentication method will first tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

Tags: Users authentication methods different specialties files industries configurations expertise topics books content actual data databases documents news terminology permissions sections Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux NVidia Xiaomi MariaDB Huawei