Article Title: Linux system permissions and command execution permissions. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Permission
The permissions of a file are divided into three types: r (readable), w (writable), and x (executable). A file can be assigned to users and groups, set permissions for other users or groups.
This permission management method is flexible, simple, rigorous, and clear. However, in the initial stage, there may be a slight discomfort. Because it is ubiquitous, and the Windows permission management you are used to is not like this (it is very messy, most of the time is like a false one, and occasionally used, it can be a headache ).
Use the chmod command to change the object ACL and chown to change the object ownership. For example:
Chmod 755 xxx
Chmod a + x xxx
Chown user: group xxx is used to change the owner user of a file. You can also change the owner group of a file.
Chgrp group xxx
The 755 and a + x Statements in the preceding command are used to change the owner group of a file.
Command Execution permission
Some commands can be executed by common users, but only the root user can successfully execute them. Why?
For example, add a new user useradd in the system.
Ls-l/usr/sbin/useradd:
-Rwxr-xr-x 1 root 56156/usr/sbin/useradd
Can all users perform this operation?
This is because the useradd command is a tool for modifying the/etc/passwd file. Let's take a look at this file:
Ls-l/etc/passwd-rw-r -- 1 root 1835 2007-11-01 16: 04/etc/passwd
It turns out that only the root user can write the Modification result, and the non-root user will certainly not execute the useradd command.