UbuntuLinux8.04Vsftp virtual user configuration

Source: Internet
Author: User
Article Title: UbuntuLinux8.04Vsftp virtual user configuration. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1. First confirm that vsftpd has been installed, and the following two subdirectories are created under the/home/ftp directory:

User1

User2

2. Create a virtual user database

Create the login file loguser.txt

The format is as follows:

User_name

User_password

Therefore, the content of the ftpuser.txt file is

User1 # The main directory of user1 is user1, which has only the read-only permission.

User1

User2 # The main directory of user2 is user2, which has only read-only permission.

User2

User1w # The main directory of user1w is user1, which has all Permissions

User1w

Generate Database

If you haven't installed a libdb3-util before or you don't know how to install it, run the following command first.

Sudo apt-get install libdb3-util

Then, we execute

Sudo db3_load-T-t hash-f ftpuser.txt/etc/vsftpd_login.db

Set Database File Access Permissions

Sudo chmod 600/etc/vsftpd_login.db

3. Configure the PAM File

Create/etc/pam. d/vsftpd. vu as follows:

Auth required/lib/security/pam_userdb.so db =/etc/vsftpd_login

Account required/lib/security/pam_userdb.so db =/etc/vsftpd_login

The database vsftpd_login we created in the previous step is used here

The created virtual user will use PAM for verification. This is enabled through the statement pam_service_name = vsftpd. vu in the/etc/vsftpd. conf file.

4. Create a local system user for a virtual user

Create a system user jtmvi. the user's home directory is/home/ftp, and the user's logon terminal is set to/bin/false (even if the user cannot log on to the system)

Sudo useradd jtmvi-d/home/ftp-s/bin/false

Sudo chown jtmvi. jtmvi/home/ftp

Sudo chown jtmvi. jtmvi/home/ftp/user1

Sudo chown jtmvi. jtmvi/home/ftp/user2

Sudo chmod 700/home/ftp

5. Configure/etc/vsftpd. conf

Create/etc/vsftpd. conf as needed. Make sure that the following settings are included:

Listen = YES

Anonymous_enable = NO

Dirmessage_enable = YES

Xferlog_enable = YES

Xferlog_file =/var/log/vsftpd. log

Xferlog_std_format = YES

Chroot_local_user = YES

Guest_enable = YES

Guest_username = jtmvi

User_config_dir =/etc/vsftpd_user_conf

Pam_service_name = vsftpd. vu

Local_enable = YES

Up to now, all three of our users can work, but their root directories are all/home/ftp, with the same permissions. So how can we achieve our goal?

6. Configure/etc/vsftpd_user_conf

In the above configuration, there is such a line

User_config_dir =/etc/vsftpd_user_conf

Now, we need to put the configuration files of each user in the/etc/vsftpd_user_conf directory.

Sudo mkdir/etc/vsftpd_user_conf

Cd/etc/vsftpd_user_conf

Sudo touch user1 user2 user1w

Content in user1 File

Local_root =/home/ftp/user1

Content in user2 File

Local_root =/home/ftp/user2

Content in user1w File

Write_enable = YES

Anon_world_readable_only = NO

Anon_upload_enable = YES

Anon_mkdir_write_enable = YES

Anon_other_write_enable = YES

Local_root =/home/ftp/user1w

7. Complete

Restart vsftpd

/Etc/init. d/vsftpd start | restart

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.