Article Directory
- Chapter 6
- 1. users and groups
- 2. Linux file permissions concept
- 2.1 Linux file attributes
- 2.1 change file attributes and permissions
- Permissions meaning 2.2 files and directories
- 2.2.1 r rights
- 2.2.2 w permissions
- 2.2.2 x permissions
- 2.2.2 rx folder permissions, file permissions x
- 2.2.2 rx folder permissions, file permissions rx
- 2.2.2 Folder rwx permissions, file no authority
- 3. Directory Configuration
Chapter 6
1. users and groups
File access can access the identity of the three categories
- owner
- group
- others
Accounts recorded in the / etc / passwd file
password in / etc / shadow file
user group names recorded in the / etc / group file
2. Linux file permissions concept
2.1 Linux file attributes
ls command to display the name of a file and related properties.
To Hide file when the file beginning.
The first column represents the file type the letters of permission.
File size capacity, the default unit is B
Terminal command line can not display Chinese, if you want to set the system default language, set the file / etc / sysconfig / i18n.
Note: This only applies to CentOS 5,6. In CentOS 8 has no such files, as opposed to, you can set the system default language by modifying the file /etc/locale.config
For a directory, have both r and x permissions of people to enter; w have permission to write.
2.1 change file attributes and permissions
command | effect |
---|---|
chgrp | Change the user group |
chown | Changing Ownership |
chmod | Change permissions |
Note: We use the cp command to copy the file to someone else, the file attributes and permissions will be copied together. So if you want others to use our copy of the file, you also need to change the file attributes and permissions
Note: When we use these three commands folder will not have folder files from the effect. If you want to simultaneously change the folder properties and permissions in the file, add -R
the option to perform recursive folder.
When using the chmod command, you can use two methods: digital change and letter changes .
- Digital Law
letter | Digital representation |
---|---|
r | 4 |
w | 2 |
x | 1 |
Experimental Procedure:
2. letter method
experiment:
Permissions meaning 2.2 files and directories
2.2.1 r rights
In the first drawing under the root user to set permissions:
then switch a regular user testing:
Use ls can see the file name, but did not know the property with ll file.
The strange thing is, you can not use the cat command to get the echo file.
Use the vi command to open the file, you can not see the contents of the documents can not be edited:
cd command can not be used:
2.2.2 w permissions
The following diagram first to set permissions on the root user:
and then switch to test an ordinary user:
LS, LL, CAT can not be used:
the use of echo redirect files can not be changed:
the same, using the vi command to open a file, you can not see the file content can not be edited:
cd command can not be used:
2.2.2 x permissions
In the first drawing under the root user to set permissions:
Anyway, root can always execute an executable file:
and then switch to test an ordinary user:
LS, LL, CAT command can not be used.
cd command can be used.
Executable files can not be used!
2.2.2 rx folder permissions, file permissions x
The following diagram first to set permissions on the root user:
not, who can tell me why testdir up and down the folder permission settings are not the same?
An ordinary user and then switch to test:
the executable file can not be executed.
2.2.2 rx folder permissions, file permissions rx
In the first case the root user to set permissions FIG:
before switching a normal user test:
may be performed.
As can be seen, in order to execute executable file, folder and file permissions should rx.
2.2.2 Folder rwx permissions, file no authority
However, if a user has rwx permissions to the folder, while he had no permission to file in this folder, although the user can not view, modify, and execute the file, but the user but can remove it.
It's like I've got a stone, although I do nothing on this stone, but throw it out, I can still do.
3. Directory Configuration
This chapter also describes the FHS standard directory configuration, but some directory changes, I change I found listed here.
3.1 / bin, / lib, / lib64, / sbin directory
CentOS 6 Screenshot:
CentOS 8 shots:
the map can be seen, these files in the root directory folder has become symbolic links.
3.2 /etc/init.d directory
6 CentOS:
CentOS 8:
Since the time of the revision CentOS 7, this folder has been moved empty.
This is the README information in the figure above:
3.3 / selinux directory
6 CentOS:
CentOS 8:
CentOS 8 simply do not have this directory, the directory does not know where to run?
3.4 CentOS View
View Which Linux distribution using standard.
6 CentOS:
CentOS 8 did not have the command. . .