Environment: UUbuntu8.041. install the vsftpdsudoapt-getinstallvsftpd2. when you create a guest user vsftpd for installation, the system automatically switches to an ftp user. In passwd, delete sudouseraddvirtual and set the virtual password to webftpsudopasswdvirtual. Edit the virtual user's home directory and set s.
Configuration environment: UUbuntu 8.04
1. Install vsftpd
Sudo apt-get install vsftpd
2. Create a guest user
During vsftpd installation, an ftp user is automatically installed and deleted from passwd.
Sudo useradd virtual
Set the virtual password to webftp.
Sudo passwd virtual
Edit the virtual user's home directory and set shell
Sudo vim/etc/passwd
I set virtual: x: 1001: 1001:/var/www:/bin/false.
/Var/www virtual home directory
/Bin/false disable virtual terminal Login
3. Set mysql database and User Permissions
Create a vsftp database vsftp user in phpmyadmin
Create user table
Create table users (name char (16) binary, passwd char (16) binary );
Grant the select permission to the User users table of vistual and set the password.
4. Set PAM verification for MySQL
Install libpam-mysql
Sudo apt-get install libpam-mysql
PAM Authentication File For vsftpd
Sudo cp/usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/vsftpd. pam/etc/pam. d/vsftpd
Replace the following content:
Auth required/lib/security/pam_mysql.so user = virtual passwd = webftp host = localhost db = vsftp table = users usercolumn = name passwdcolumn = passwd crypt = 2
Account required/lib/security/pam_mysql.so user = virtual passwd = webftp host = localhost db = vsftp table = users usercolumn = name passwdcolumn = passwd crypt = 2
5. Set vsftpd. conf
Guest_enable = YES
Guest_username = virtual
These two items must be enabled. For other configurations, see the vsftpd. conf configuration manual.
6. Change the permission of the virtual user directory to be operated only by virtual:
Sudo chown virtual. virtual/var/www
Sudo chmod 755/var/www
Obtain the www folder permission and set the www folder permission to 755.
Now, the most basic virtual user has been completed.
Sudo/etc/init. d/vsftpd restart
After the vsftpd service is restarted, you can use the username and password set in the users table to access the www folder.