Ubuntu + vsftpd + mysql + pam is configured correctly on the ftp server.

Source: Internet
Author: User
Tags crypt
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.

Related Article

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.