Home > Database > Mysql Tutorial > body text

Linux下利用MySQL建立VSFTPD下的虚拟用户

WBOY
Release: 2016-06-07 16:52:02
Original
1168 people have browsed it

环境:Linux操作系统前提:以经安装VSFTPD、MySQL、PAM_MySQL1、添加VSFTPD用户[root@xxx]#useradd ftpguest当虚拟用户登录后,所

环境:Linux操作系统

前提:以经安装VSFTPD、MySQL、PAM_MySQL

1、添加VSFTPD用户
[root@xxx]#useradd ftpguest
当虚拟用户登录后,所在的位置为vsftpguest的自家目录/home/vsftpguest。如果要让虚拟用户登录到/var/ftp等其他目录,修改vsftpguest的自家目录即可。

2、建立虚拟用户数据库
mysql>create database ftpuser;
mysql>use ftpuser;
mysql>create table users(name char(20), passwd char(20));
mysql>insert into users
->values ('ftp', 'ftp');
mysql>quit

3、为ftpguest设置数据库读取权限
mysql>grant select on ftpuser.users to vsftpguest@localhost identified by 'you_password';
mysql>quit

4、配置VSFTPD,使其使用虚拟用户登录
/etc/vsftpd/vsftpd.conf
添加:
chroot_local_user=YES
chroot_list_enable=YES

5、为VSFTPD添加授权
/etc/pam.d/vsftpd
auth required pam_mysql.o user=vsftpguest passwd=you_password host=localhost db=ftpuser table=users usercolumn=name passwdcolumn=passwd crypt=0
account required pam_mysql.o user=vsftpguest passwd=you_password host=localhost db=ftpuser table=users usercolumn=name passwdcolumn=passwd crypt=0

6、重启VSFTPD
[root@xxx]#service vsftpd restart

注:更改/etc/pam.d/vsftpd时,删除原内容,只存在以上内容。

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!