How to use VSFTPD to build an FTP server for a specified user-specified directory in Linux

Source: Internet
Author: User

One. Check the installation of VSFTPD in Linux.

Two. Shut down SELinux in the system and restart the computer

To close the SELinux method:

Modify the Selinux= "" in the/etc/selinux/config file to Disabled, and then restart.
If you do not want to restart the system, use the command Setenforce 0
Note:
Setenforce 1 setting SELinux to become enforcing mode
Setenforce 0 Setting SELinux to become permissive mode
Added in Lilo or grub boot parameters: Selinux=0, can also turn off SELinux

Setsebool Ftpd_disable_trans 1

Three. Creating users and specifying directories

#useradd-D/home/ftpdata3 FTP3

#passwd FTP3

Establish the user ftp3 and specify its FTP directory as ftpdata3

#useradd-D/home/ftpdata3 FTP4

#passwd FTP4

Establish the user FTP4 and specify its FTP directory as FTPDATA4

This allows the FTP3 and FTP4 users to be assigned to the appropriate folder.

Four. Modifying the vsftpd.conf configuration file

Change anonymous_enable to No to prevent anonymous uploads

Remove comments from chroot_list_enable and chroot_list_file to prevent users from accessing the parent directory

Five. Create a chroot_list file under/ETC/VSFTPD

When Setup is complete, add the user FTP3,FTP4 to allow access to only the specified directory.

Six. Start or restart the FTO service.

#service vsftpd Restart (start)

Once you have successfully started, you can access the FTP service.

Note: The explanation in the configuration file

Anonymous_enable=yes Open Anonymous User login
Local_enable=yes turn on local user login
Write_enable=yes turn on Write permission to upload
local_umask=022 set upload file for user=rwx, group=, other=
This way, after the user uploads the file, it cannot be deleted or modified. Because the user belongs to group groups.
The workaround is to set the local_umask=002.
Final file permission is 777-Folder mask-local_umask mask
Anon_upload_enable=yes Open Anonymous User upload permission
Unified Anonymous upload properties of uploaded files by users
Chown_uploads=yes
Chown_username=ftp
Set chroot configuration to prohibit specific users from accessing the previous level of directory
Chroot_list_enable=yes
Chroot_list_file=/etc/vsftpd/chroot_list
Userlist_enable=yes This option if yes, users in the/etc/vsftpd/user_list will be prevented from accessing FTP. If no, only users inside the User_list can access the FTP


How to use VSFTPD to build an FTP server for a specified user-specified directory in Linux

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.