Configuring VSFTPD virtual users in a Linux environment

Source: Internet
Author: User

Environment: CentOS Linux release 7.4.1708 (Core)
VSFTPD version: Vsftpd:version 3.0.2


1, installation vsftpd
# yum-y Install VSFTPD

2. Establish a virtual user account password
# vim/etc/vsftpd/users
Ftp1
123456

3. Create a virtual user database file
# db_load-t-T hash-f/etc/vsftpd/users/etc/vsftpd/virtual_users.db

4. Create a local directory for the virtual account
# mkdir-p/VAR/FTP/USERS/FTP1

5. Backup and configure VSFTPD files for virtual users
# Cp/etc/vsftpd/vsftpd.conf/etc/vsftpd/vsftpd.conf.bak
# vim/etc/vsftpd/vsftpd.conf

Anonymous_enable=no
Local_enable=yes
Virtual_use_local_privs=yes
Write_enable=yes
Allow_writeable_chroot=yes
Pam_service_name=vsftpd.virtual
Guest_enable=yes
user_sub_token= $USER
local_root=/var/ftp/users/$USER
Chroot_local_user=yes
Hide_ids=yes
Xferlog_enable=yes
Vsftpd_log_file=/var/log/vsftpd.log
Log_ftp_protocol=yes
Pasv_enable=yes
pasv_max_port=21000
pasv_min_port=20000

6. Create the Pam file and use the new database file above
New Pam File:
# vim/etc/pam.d/vsftpd.virtual
Auth Required pam_userdb.so Db=/etc/vsftpd/virtual_users
Account Required Pam_userdb.so Db=/etc/vsftpd/virtual_users
Session Required Pam_loginuid.so

7. Configure the Firewall
# iptables-i input-p TCP--destination-port 20:21-j ACCEPT
# iptables-i input-p TCP--destination-port 20000:21000-j ACCEPT

8. Modify the owner and the group to which it belongs
# chown FTP.FTP/VAR/FTP/USERS/FTP1
If the system does not have an FTP user, you need to manually create
# useradd-d Varftp-s/sbin/nologin FTP

9. Start the service and turn off SELinux
# Systemctl Start vsftpd
# Vim/etc/selinux/config
Change Selinux=enforcing to Selinux=disabled

10. Testing
[Email protected]:~$ ftp 192.168.199.153
Connected to 192.168.199.153.
(VsFTPd 3.0.2)
Name (192.168.199.153:vbox): FTP1
331 Specify the password.
Password:
Successful Login.
Remote system type is UNIX.
Using binary mode to transfer files.
Ftp> put Hello.txt
PORT command successful. Consider using PASV.
Ok to send data.
226 Transfer complete.
7 Bytes Sent in 9.1e-05 seconds (75.1 kbytes/s)

Configuring VSFTPD virtual users in a Linux environment

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.