Configure sudo in Linux
Operating System: RHEL 6.4-64-bit
After configuring sudo, the root user can execute commands as the root user.
By default, normal users have full management permissions on their home directories, but do not have permission to view the files in other users' home directories.
An error is reported when you use a common user to view the directories of other users.
[Tom @ rhel64 ~] $ Pwd
[Tom @ rhel64 ~] $ Ls/root
[Root @ rhel64 ~] # Mongodo
Or
[Root @ rhel64 ~] # Vi/etc/sudoers
Append a line of content after Line 98. Refer to the root line.
Allow the tom user to execute any command anywhere
Tom ALL = (ALL) ALL
If you run the ls/root command again as a common user, the system still reports an error. If you run the sudo ls/root command, the system prompts you to enter the tom user password.
The password is correct. You can see the content in the/root directory.
[Tom @ rhel64 ~] $ Ls/root
[Tom @ rhel64 ~] $ Sudo ls/root
You do not need to enter a password when executing the command again.
[Tom @ rhel64 ~] $ Sudo ls/root
You can also use sudo to execute other commands.
The sudo configuration can also define specific commands and group members. For details, refer to/etc/sudoers.
At this time, the tom user directly views this file and has no permission to view it using the sudo command.
[Tom @ rhel64 ~] $ Tail-25/etc/sudoers
[Tom @ rhel64 ~] $ Sudo tail-25/etc/sudoers
Differences between Linux su and sudo commands
Sudo command usage
Use and enable the root account with Ubuntu sudo and su commands
Sudo: sorry, you must have a tty to run sudo
Configure sudo permissions in Linux
Temporary root permission for sudo Configuration
How to solve the problem that users cannot execute sudo in Linux
The Linux system administrator must not know the command: sudo
Sudo permission allocation
This article permanently updates the link address: