One: Installation FTP
1. Check if FTP is installed: (is the installed effect, no installation not shown)
Rpm-qa|grep vsftpd
2, Installation instructions: (Find a-y command)
Yum Install-y vsftpd
3. After the installation is complete, follow step 1 to see the version information of FTP
4. After the installation is complete, start the FTP service:
Service VSFTPD Start
5, after starting, you can see that the system has been listening to 21 ports:
NETSTAT-NLTP | grep 21
6. Disabling anonymous users
vi/etc/vsftpd/vsftpd.conf (anonymous_enable=no-----Yes change to NO)
7. Restart after saving
Service VSFTPD Restart
Two: Create User rights
1, create the user, and specify the grouping and home directory (according to their own requirements set parameters)
Useradd-d/opt/reconciliation-s/sbin/nologin-g ftpgroup-g root Ftpuser
Analytical:
Useradd Adding user Ftpuser
-d specifies that the user root directory is/opt/reconciliation
-s specifies that the shell script is/sbin/nologin, which indicates that the shell login is not allowed
-G Create Group Ftpgroup
-G Specify root Group
PS: Create a problem can delete re-create Userdel-r Ftpuser
2. Set the password
passwd Ftpuser
3. Set access rights
Chown ftpuser/opt/reconciliation/
Change the FTP configuration file
Modify the configuration file/etc/vsftpd/vsftpd.conf and set or delete the comment:
Userlist_enable=no
Anonymous_enable=no
Chroot_list_enable=yes
Chroot_list_file=/etc/vsftpd/chroot_list
Open/etc/vsftpd/user_list and add a line:
Ftpuser
Create a new file/etc/vsftpd/chroot_list and add a row
Ftpuser
4. Configure user FTP permissions and access path restrictions:
At this time with Usertest login system FTP, is it possible to access? If you can't access it, our FTP is limited. Open/etc/vsftpd/vsftpd.conf, find userlist_enable, Userlist_deny, Userlist_file. If Userlist_deny=no: Only allow users in the Userlist_file file to access FTP, if the user listed in the Userlist_deny=yes:userlist_file file cannot access the system via FTP. The userlist_enable is the switch for this function. Our system is configured as follows:
Userlist_enable=yes
Userlist_deny=no
Userlist_file=/etc/vsftpd/user_list
So you need to add the user to the/etc/vsftpd/user_list file, one row per user.
Since the home directory is built by MPSP users, Usertest is a member of the MPSP group, so Usertest has the default of adding and removing permissions, and Usertest as a member of the MPSP group, has access to all paths under/HOME/MPSP (depending on the permissions settings for each directory, The default is this), login FTP will find that usertest users can access other directories, and have MPSP group permissions, this is not allowed, we need to control the Usertest user access to their home directory. Here's how:
1. cd/etc/vsftpd into the FTP configuration file directory
2. VI vsftpd.conf edit this file, find the #chroot_list_enable=yes, delete the previous # number, indicating that the limit function is turned on
Find Chroot_list_file:chroot_list_file=/etc/vsftpd/chroot_list
3. Edit the Chroot_list file, add the user name you want to restrict, and one user at a line.
If you have updated vsftpd.conf, be sure to restart FTP with the following command:
[email protected] sir001root]#/etc/init.d/vsftpd restart
Close vsftpd:[OK]
For vsftpd start vsftpd:[OK]
Start the FTP service
Service VSFTPD Start
There are also two parameters: stop, restart
Three: Permission settings
- rw-r--r--. 1 root root 1944 May 17:21 initial-setup-ks.cfg
A total of 10 digits
Which: the first one-represents the type, if it is the directory, the first one is D
The middle three rw-represents the owner (user)
Then those three rw-represent groups (group)
The last three r--represent others (other).
And then I'll explain the 9 digits in the back:
R indicates that a file can be read (read)
W indicates that the file can be written (write)
x indicates that the file can be executed (if it is a program)
-Indicates that the appropriate permission has not been grantednow it's time to talk about modifying file permissions.:
In Terminal input:
chmod o+w xxx.xxx
Give other people permission to write xxx.xxx this file
chmod GO-RW xxx.xxx
Represents the ability to delete read and write permissions for groups and other people in xxx.xxx where:
U on behalf of owner (user)
G represents the group where the owner resides
O stands for others, but not u and g (other).
A represents all people, including U,g and O.
R indicates that a file can be read (read)
W indicates that the file can be written (write)
x indicates that the file can be executed (if it is a program)
Where: Rwx can also be replaced by numbers
R------------4
W------------2
X------------1
-------------0 Action:
+ means add permission
-Indicates delete permission
= means to make it the only permission when everyone understands what's above, it's easy to understand that some of the following permissions are common:
-RW-------(600) Only the owner has read and write permissions
-rw-r--r--(644) Only the owner has read and write permissions, and the group and other people only have Read permissions
-RWX------(700) Only the owner has read, write, execute permissions
-rwxr-xr-x (755) Only the owner has read, write, execute permissions, groups and other people only read and Execute permissions
-rwx--x--x (711) Only the owner has read, write, execute permissions, groups and other people only execute the permissions
-rw-rw-rw-(666) Everyone has access to read and write
-RWXRWXRWX (777) Everyone has access to read and write and execute
Example:
chmod 777/home/user Note: Only the/home/user directory permissions are set to RWXRWXRWX
If you want to put a separate file to the corresponding account set permissions, to use the corresponding account to log on to Linux to set up this account for example: I want to/home/user this file to the Admin permission read-only permission
You need to use the Admin account login settings chmod 500/home/user (4 is read-only, preferably each time 1 plus 5)
In special cases:
Setfacl-m u:admin:rwx/home/mengniu_xm/mengniu_r This command for individual users to set permissions for individual files (Mengniu_r to the admin account rwx permissions)
Reference:
Https://www.linuxidc.com/Linux/2017-11/148518.htm---Install FTP and add users
52037497---adding users
52041782---permission settings
Install FTP under Linux in detail