VSFTPD Server Virtual User Configuration

Source: Internet
Author: User
Tags ftp mkdir touch

The system environment is: CentOS 5.5 x86_64

VSFTPD has three user modes: Anonymous user, local user, virtual user. This time we explain the virtual user, its advantage is high security, easy to manage.

The code is as follows

# through Yum directly in the sewing vsftpd (RPM version)

Yum-y Install VSFTPD db4-utils

# Create a vsftp system user

Useradd vuser-s/sbin/nologin

# Create a list of system users, one line at a

Touch/etc/vsftpd/chroot_list


# Create a configuration file path directory for the virtual user

Mkdir/etc/vsftpd/user_config

# Write the vsftp system user to Vsftpd.chroot_list

echo "VUser" >/etc/vsftpd/chroot_list

# Prepare to work, create vuser, single line for username, double act password

Touch/etc/vsftpd/vuser

Content for example: www.111cn.net

Ftp1

123456

Ftp2

123456

The code is as follows

# Create a virtual user password certified database file

Db_load-t-T Hash-f/etc/vsftpd/vuser/etc/vsftpd/vuser.db

# Direct Edit Authentication file

Vi/etc/pam.d/vsftpd

# Empty the contents or comment out (front plus #), add the following two lines

Auth Required pam_userdb.so Db=/etc/vsftpd/vuser
Account Required Pam_userdb.so Db=/etc/vsftpd/vuser

# Edit the vsftp configuration file

Vi/etc/vsftpd/vsftpd.conf

#################################

Local_enable=yes
Write_enable=yes
local_umask=022
Anon_upload_enable=no
Anon_mkdir_write_enable=no
Dirmessage_enable=yes
Xferlog_enable=yes
Connect_from_port_20=yes
Chown_uploads=no
Xferlog_file=/var/log/vsftpd.log
Xferlog_std_format=yes
Async_abor_enable=yes
Ascii_upload_enable=yes
Ascii_download_enable=yes
Ftpd_banner=welcome to Elain FTP service.
Chroot_list_enable=yes
Chroot_list_file=/etc/vsftpd/chroot_list
Chroot_local_user=no
Listen=yes

Pam_service_name=vsftpd
Userlist_enable=yes
Tcp_wrappers=yes
Guest_enable=yes
Guest_username=vuser
User_config_dir=/etc/vsftpd/vuser_config
Reverse_lookup_enable=no

##############################
# Create configuration files for each virtual user

Vi/etc/vsftpd/vuser_config/ftp1

# Add the following content
############################

Local_root=/www/htdocs/ftp1
Write_enable=yes
Anon_world_readable_only=no
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes

############################ www.111cn.net

# The same way to build FTP2, if users have more words, write/etc/vsftpd/vuser to generate password-authenticated database files

Mkdir-p/www/htdocs/ftp{1,2}

echo "FTP1 is OK" >/www/htdocs/ftp1/ftp1.txt
echo "FTP2 is OK" >/www/htdocs/ftp2/ftp2.txt

Chown-r VUSER/WWW/HTDOCS/FTP1
Chown-r VUSER/WWW/HTDOCS/FTP2

# Start VSFTP Server

/ETC/INIT.D/VSFTPD restart

# Verify Login

Host Name: IP address of your server

User: ftp1/123456

User: ftp2/456789

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.