linux-12th Lesson Note-[FTP Server build]-[virtual user ftp]-[03]

Source: Internet
Author: User

FTP Virtual User Server Setup:

Create an account list:

[Email protected] vsftpd]# echo-e "msl23\n123\nbenet\n123" >> vusers.list

[email protected] vsftpd]# cat Vusers.list

Msl23

123

Benet

123

[Email protected] vsftpd]#

Use Db_load to turn the table into a database:

[Email protected] vsftpd]# db_load-t-t hash-f vusers.list vusers.db

-T: Other programs that use the database must use the-t

-T: algorithm \ Cryptographic algorithm using hash hash

-F: password file

[[Email protected] vsftpd]# file vusers.db

Vusers.db:Berkeley db (Hash, version 9, native Byte-order)

Set up your account password file to enhance security:

[email protected] vsftpd]# ll vusers.*

-RW-------1 root root 12288 06:11 vusers.db

-RW-------1 root root 06:07 vusers.list

Set up PAM authentication:

[Email protected] vsftpd]# Vim/etc/pam.d/vsftpd.vu

Auth Required pam_userdb.so Db=/etc/vsftpd/vusers

Account Required Pam_userdb.so Db=/etc/vsftpd/vusers

Create an account a virtual account is mapped to the user:

[Email protected] vsftpd]# useradd-d/var/ftproot/-s/sbin/nologin Virtual

[[email protected] vsftpd]# ID virtual

uid=503 (virtual) gid=503 (virtual) groups=503 (virtual)

[Email protected] vsftpd]#

Create a virtual account profile named after the account name:

[Email protected] vsftpd]# mkdir./vusers.dir

[[Email protected] vsftpd]# CD./vusers.dir

[email protected] vusers.dir]# Touch msl23

[email protected] vusers.dir]# Touch Benet

[[email protected] vusers.dir]# ls

Benet msl23

[Email protected] vusers.dir]#

To write a configuration file:

User msl23:

[Email protected] vusers.dir]# vim msl23

anon_upload_enable=yes #允许上传

Anon_mkdir_write_enable=yes #运行创建目录

Anon_other_write_enable=yes #开启其他权限

anon_max_rate=0 #最大速度 0 is an unlimited speed

local_root=/var/msl23 #设置根目录

User benet:

[Email protected] vusers.dir]# Vim Benet

Anon_upload_enable=yes

Anon_max_rate=0

Local_root=/var/benet

Configure the VSFTPD profile associated account profile:

[Email protected] vsftpd]# vim vsftpd.conf

Anonymous_enable=no #关闭匿名用户

119 Pam_service_name=vsftpd.vu #pam认真地址

Guest_enabled=yes #激活来宾用户

121 guest_username=virtual #设置来宾用户名

122 Userlist_enable=yes

123 Tcp_wrappers=yes

124 user_config_dir=/etc/vsftpd/vusers.dir/ #关联账号配置文件

Create the FTP directory for the virtual user and set the owner as virtual:

[Email protected] vsftpd]# mkdir/var/msl23

[Email protected] vsftpd]# mkdir/var/benet

[Email protected] vsftpd]# chown virtual/var/benet

[Email protected] vsftpd]# chown virtual/var/msl23

[Email protected] vsftpd]# ll-d/var/msl23/var/benet

Drwxr-xr-x 2 virtual root 4096 06:37/var/benet

Drwxr-xr-x 2 virtual root 4096 06:36/var/msl23

Start the service:

[Email protected] vsftpd]#/etc/init.d/vsftpd Reload

Shutting down VSFTPD: [OK]

Starting vsftpd for VSFTPD: [OK]

Verify:

Msl23:

Benet:

linux-12th Lesson Note-[FTP Server build]-[virtual user ftp]-[03]

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.