RHEL7--Linux build FTP virtual user

Source: Internet
Author: User

Installing the VSFTPD Package
[email protected] ~]# Yum install vsftpd-y
[email protected] ~]# Yum install DB4 db4-utils

The host user who established the VSFTPD service
[Email protected] ~]# useradd vir-s/sbin/nologin

Create a log file
[Email protected] ~]# Touch/var/log/vsftpd.log
[Email protected] ~]# chown Vir:vir/var/log/vsftpd.log

Modifying the VSFTP configuration file
[Email protected] ~]# vi/etc/vsftpd/vsftpd.conf
#不允许匿名访问
Anonymous_enable=no
#本地用户可以访问
Local_enable=yes
#使用户不能离开主目录
Chroot_list_enable=yes
#允许上传
Ascii_upload_enable=yes
#支持ASCII模式的下载功能
Ascii_download_enable=yes
#千万别忘记添加
Pam_service_name=vsftpd

#手工输入以下参数和值
#开启虚拟用户的功能
Guest_enable=yes
#指定虚拟用户的宿主用户
Guest_username=vir
User_config_dir=/etc/vsftpd/vuser_conf
#vsftpd的服务日志保存路径, default does not exist
Xferlog_file=/var/log/vsftpd.log

Create a virtual user list file first
[Email protected] ~]# vi/etc/vsftpd/vsftp_users.conf
#输入奇数行为账号, even behavior password
YB1 #账号
abcd1234 #密码
Yb2
abcd1234

Generate Authentication Files
Db_load Install db4-utils If you can't find it (yum install DB4 db4-utils)
[Email protected] ~]# db_load-t-t hash-f/etc/vsftpd/vsftp_users.conf/etc/vsftpd/vsftp_users.db
Modify its permissions
[Email protected] ~]# chmod 600/etc/vsftpd/vsftp_users.db

Edit the authentication file, empty or annotate all the contents of the file (keep the first line of content)
[Email protected] ~]# VI/ETC/PAM.D/VSFTPD
After emptying, lose again.
Auth Required pam_userdb.so Db=/etc/vsftpd/vsftp_users
Account Required Pam_userdb.so Db=/etc/vsftpd/vsftp_users

Establish a virtual user profile where to store it
[Email protected] ~]# mkdir/etc/vsftpd/vuser_conf/

Custom Users (you can set different virtual user permissions, etc.)
[Email protected] ~]# VI/ETC/VSFTPD/VUSER_CONF/YB1

Add the following content
LOCAL_ROOT=/DATA01/YB1 #虚拟用户yb2根目录
Write_enable=yes
anon_umask=022
Anon_world_readable_only=no
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes

[Email protected] ~]# VI/ETC/VSFTPD/VUSER_CONF/YB2

Add the following content
LOCAL_ROOT=/DATA01/YB2 #虚拟用户yb2根目录
Write_enable=yes
anon_umask=022
Anon_world_readable_only=no
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes

OK, start or restart Vsftp
[[email protected] ~]# systemctl vsftpd Restart (restart restart)


Error when connecting to FTP: VSFTPD 530 Login Incorrect
Cause: There are spaces in the/etc/vsftpd.conf parameter configuration
Workaround: Remove spaces


Error when connecting FTP: OOPS:vsftpd:refusing to run with writable root inside Chroot ()
Cause: The security rule of VSFTPD is that FTP users are not allowed to have writable access to the FTP root directory, so that FTP user is rejected by the server.
Workaround:
chmod a-w/DATA01/YB1
chmod a-w/DATA01/YB2

RHEL7--Linux build FTP virtual user

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.