RedHat5.5 vsftpd server construction configuration Record Based on Virtual User Authentication

Source: Internet
Author: User
1. Create a virtual user password library file # vi/etc/vsftpd/login.txt Add the user name and password (the odd line is the user name, and the even line is the password ): ftp_test123456wq save exit II. Generate vsftpd authentication file # db_load-T-thash-f/etc

1. Create a virtual user password Library File

  1. # Vi/etc/vsftpd/login.txt

Add the username and password (the odd line is the username, and the even line is the password ):

Ftp_test
123456

Wq save and exit

Ii. Generate vsftpd Authentication Files

  1. # Db_load-T-t hash-f/etc/vsftpd/login.txt/etc/vsftpd/login. db

If you are prompted that the db_load command is not available, install the db4-utils first:

  1. # Yum install db4-utils

3. Set the authentication file to be readable and writable only to the root user

  1. # Chmod 600/etc/vsftpd/login. db

4. Create the PAM Configuration File required by the virtual user and manually create the vsftpd. vu File

  1. # Vi/etc/pam. d/vsftpd. vu

Input:

  1. Uth required pam_userdb.so db =/etc/vsftpd/login
  2. Account required pam_userdb.so db =/etc/vsftpd/login

Note: Do not add a path before pam_userdb.so.

5. Create a system user account used by all FTP virtual user accounts and Set permissions for the home directory of the account

  1. # Useradd-d/home/vsftp-s/sbin/nologin vftp

6. Configure the vsftpd. conf file

  1. # Vi/etc/vsftpd. conf

Modify and add content:

  1. Anonymous_enable = NO # disable anonymous user logon
  2. Anon_umask = 002
  3. Anon_world_readable_only = NO # downloadable
  4. Anon_upload_enable = YES # upload allowed
  5. Anon_mkdir_write_enable = YES # You can create a directory.
  6. Anon_other_write_enable = YES # It can be modified or deleted.
  7. Guest_enable = YES # open a virtual user
  8. Guest_username = vftp # system user corresponding to the FTP virtual user Pam_service_name = vsftpd. vu # PAM Authentication File
  9. Local_root =/var/www/html # directory automatically switched after login (if this line is not added, the virtual user logs on to the/home/vsftp directory)
 

Wq is saved and exited.

7. Restart the vsftpd service

  1. # Service vsftpd restart

8. Solve the problem that apache files cannot be accessed (displaying files without permission)
Add an ftp user (vftp here) to the apache user group, and set the user group to have the write permission:

  1. # Usermod-a-G apache vftp # Add vftp to User Group apache
  2. # Chown-R: apache/var/www/html # Set/var/www/html to apache
  3. # Chmod-R g + rw/var/www/html # Set the/var/www/html permission to allow the user group to read and write

Note: you also need to confirm anon_umask = 002 in vsftpd. conf so that the user group of the newly uploaded file has the write permission.

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.