Install vsftpd on centos7

Source: Internet
Author: User

1. Disable sellinux

View SELinux status:

1./usr/sbin/sestatus-V # If The SELinux status parameter is enabled, SELinux status: Enabled

Disable SELinux:

1. temporarily shut down (no need to restart the machine ):

Setenforce 0 # Set SELinux to permissive Mode

# Setenforce 1 Set SELinux to enforcing Mode

2. to modify the configuration file, restart the machine:

Modify the/etc/SELinux/config file

Change SELinux = enforcing to SELinux = disabled

Restart the machine. If SELinux is not disabled, a mess may occur, such as 530 login incorrect. The path conversion fails, the folder is not displayed, and the file cannot be uploaded. I have not studied how to set SELinux for the moment. I just want to close it.

2. Add port configurations to the firewall

VI/etc/sysconfig/iptables

 

-A input-p tcp-M state -- state new-m tcp -- dport 21-J accept

-A input-p tcp-M state -- state new-m tcp -- dport 30000: 30999-J accept

Restart Firewall

3. Install vsftpd

Yum-y install vsftpd

 

Systemctl start vsftpd

 

VI/etc/vsftpd. conf

 

Add

Allow_writeable_chroot = Yes

Pasv_min_port = 30000

Pasvanderbilt max_port = 30999

Userlist_enable = Yes
Userlist_deny = No
Userlist_file =/etc/vsftpd/usermetadata list

 

Modify:

Anonymous_enable = No

Local_enable = Yes

Write_enable = Yes

Chroot_local_user = Yes
Chroot_list_enable = Yes (this line can be unavailable or available)
Chroot_list_file =/etc/vsftpd/chroot_list

All users added to the chroot_list file are unrestricted.
That is, you can view the parent directory of the home directory.

 

Note:

Therefore, if you do not want a user to browse the contents in the upper-level directory of the user's home directory, you can set
Do not add this user to the file chroot_list (users in this file can browse directories outside their home directories ).
Or, set as follows:
Chroot_local_user = No
Chroot_list_enable = Yes (this line must be available, otherwise the file vsftpd. chroot_list will not work)
Chroot_list_file =/etc/vsftpd/chroot_list
Then, add all users who do not want to have permission to browse the directories on their home directories to the chroot_list file (at this time, users in this file cannot browse directories outside their home directories)
(One user name in one row)

 

Si Jian Li FTP account

First, create an FTP directory or select an existing Directory.

Re-create an FTP account, and set the home directory to allow ftp only, not system Logon

Useradd username-S/sbin/nologin-D/var/www/html/

VI/etc/passwd to view the newly created account

Passwd username SET Password

VI/etc/passwd to check whether the result is correct

The usermod-D/New/home_dir-u username command can be used to change the user's home directory.

Set Directory Permissions

Chmod-r 755/ftp: Modify FTP directory and subdirectory Permissions

Modify user

Chown gamer gstore changes the gstore directory

Chown-r gamer gstore changes the gstore directory and subdirectory

Modify user group

Chown: ftp gstore changes the gstore directory

Chown-R: ftp gstore changes the gstore directory and subdirectory

Add username to the userregionlist File

 

This article is from the "Wang Sheng swimming pool" blog, please be sure to keep this source http://wangsheng1.blog.51cto.com/29473/1569071

Install vsftpd on centos7

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.