Home >Operation and Maintenance >CentOS >What is the difference between general users and root users in centos?
Difference: 1. The root user can enter any directory and have read permissions on any file, while ordinary users only have full permissions on the root directory and the directories set by the system; 2. The root user can use the system command sbin Programs in the directory cannot be used by ordinary users.
The operating environment of this article: centos 7 system, Dell G3 computer.
The main difference is that the root user (uid is 0) is a privileged user and has the highest authority of the system. Many things in Linux are the same for one-step users. The restricted ones can only be done by the root user. They are listed roughly. There may be omissions. You can add:
root privileges
1. You can enter any directory and do any Files all have read permissions, such as /etc /var, etc.
2. Generally, there are no special restrictions (sticky bits, etc.), etc. Root can operate and delete any file.
3. The programs under the system command sbin (system bin) directory (/sbin /usr/sbin...) can only be used by root.
4. Obtain some hardware data Operations, such as monitoring network card traffic.
5. It is not subject to system software and hardware restrictions, such as disk space and memory state. Root can basically break through the general restrictions and use it. For example, listening ports below 1024 are privileged ports, and only root privileges can listen.
6. You can control and manage the directories, files, processes, etc. of any account.
General users
Only have full permissions for personal user root directories (usually /hone/username), system settings 777 directories such as (/tmp), etc. , collect file system permission restrictions.
Only commands in directories such as /bin /usr/bin can be used.
Main differences
In addition to the differences listed above, there are also different directory locations. The root user has a single short directory under the system root directory. /root" directory (not readable by non-root users); general users are in the "/home/username" directory (readable only by this user and the root user);
The two terminal command prompt symbols are also different: The end of the command prompt for the root user is #, and for ordinary users it is $.
General users to root users su and sudo
General users can obtain root permissions through su and enter the root terminal. The su process requires the root password.
You can also use sudo -s (without environment variables) and sudo-i to obtain root permissions. Or use sudo cmd to execute commands with a privileged account. Sudo needs to be granted sudo permissions in advance, and you must enter your account password during use.
sudo can also limit the scope of use, directories and execution commands when granting sudo permissions, so that ordinary users can only obtain necessary privileged commands. For example, the author often uses
user ALL=(root) NOPASSWD: ALL,!/bin/bash,!/usr/sbin/visudo,!/bin/su。
. This prevents ordinary users from using sudo -s, sudo -i, modifying sudo files by themselves, using sudo su, etc. For more information, please refer to the official documentation of sudo.
Recommended tutorial: "centos tutorial"
The above is the detailed content of What is the difference between general users and root users in centos?. For more information, please follow other related articles on the PHP Chinese website!