Build ftp service under linux and set permissions

Build ftp service under linux and set permissions

The installed system is  centos 6.7

 

 

1. ftp installation:

 

Step1 : Use the yum command to install the ftp service directly

# yum install vsftpd

It is OK to display the installation ; as shown in the figure:

 

 

Step2 : FTP service open and close commands

Start: # service vsftpd start

 

 

Of course, don't forget that there are also shutdown commands as follows: # service vsftpd stop

Step3 : The installation is successful, start the test

You can use the ftp software to connect locally . The default account is the account and password of the virtual machine.

 

2. Add the ftp user in linux and set the corresponding directory permissions

 

step1 : Create user ftpuser

# useradd -d /home/ftpuser ftpuser  specifies the home directory of this user, that is, the home directory.

# passwd ftpuser  // Set password for ftpuser 

 

 

 

step2 : Change the user's corresponding permission settings

# usermod -s /sbin/nologin ftpuser  // Limited user ftpuser cannot telnet , only ftp

Of course, if you want to restore to a normal user, you can execute the following command:

# usermod -s /sbin/bash ftpuser

 

Step3 : Restrict users to only access /home/ftpuser and cannot access other paths

Modify  # /etc/vsftpd/vsftpd.conf  as follows:

 // Do not allow anonymous user access, the default is to allow.

anonymous_enable=YES  -->  anonymous_enable=NO   

 

 

Add user list file configuration:

chroot_local_user=YES 

chroot_list_enable=YES

Then specify the location of chroot_list_file . Usernames are on one line in this file.

At this point: only users listed in the chroot_list_file can switch to the directory.

 

 

If it is not in this file, ftpuser can only see the files in its own directory. As shown in the figure:

 


 
 

 

Step4 : Restart the vsFTPd server. and add boot

# service vsftpd restart

Add boot start:

 

 

As shown in the figure:

 

 

Ok!!!

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326807643&siteId=291194637