We have already elaborated on the installation and configuration of the FTP server. Here we will analyze the establishment of relevant users. The local user will not be introduced here. This article mainly introduces two methods for implementing virtual users: vsftpd's virtual user creation process.
1. Use a local data file:
Generate a virtual user file and create the/etc/vsftpd/vuser.txt file. The content is as follows:
Tonyzhang # virtual user 1111 # virtual user 1 Password tomqin # virtual user 2111 # virtual user 2 Password
Install build Database rpm package: db4-utils 。
- rpm -ivh db4-utils-4.3.29-9.fc6.i386.rpm
Generate a virtual user database 。
- db_load -T -t hash -f /etc/vsftpd/vuser.txt /etc/vsftpd/vuser.txt
Create a local ing user and modify the local ing user's home directory permissions 。
- useradd -d /var/ftp/vuserdir -s /sbin/nologin vuserchmod o+rw /var/ftp/vuserdir
Modify the pam Authentication file/etc/pam. d/vsftpd and comment out the original content 。
- authrequired /lib/security/pam_userdb.so db=/etc/vsftpd/vusersaccount required
- /lib/security/pam_userdb.so db=/etc/vsftpd/vusers
Modify/etc/vsfptd/vsftp. conf and add the following content 。
- guest_enable=YESguest_username=vuser
2. Use MySQL Data Files:
Create a local ing user 。
- useradd -s /sbin/nologin vuser
Modify/etc/vsfptd/vsftp. conf and add the following content 。
- guest_enable=YESguest_username=vuser
Install MySQL and related software packages 。
- yum -y install mysql.i*yum -y install perl-DBD-MySQL.i*yum
- -y install mysql-server.i*yum -y install mysql-devel.i*
Create a database and user table in MySQL 。
- [Root @ polo]
- # Mysql-u root mysql-pmysql> create database ftpvuser;
- # Creating a user database
- Mysql> use ftpvuser;
- # Open a database
- Mysql> create table users (name char (16) binary, passwd char (16) binary );
- # Create an access user information table
- # Insert two users and passwords
- Mysql> insert into users (name, passwd) values ('tonyzhang ', password ('123 '));
- Mysql> insert into users (name, passwd) values ('tomqin', password ('123 '));