1.1 sudo sudo is a Linux system in which non-root users elevate their privileges to perform certain feature commands, which allows ordinary users to temporarily gain root privileges without knowing the Superuser's password.
In general, ordinary users in the execution of special commands, only need to add sudo in front of a special command (such as Yum), and enter their own user password, in the next 5 minutes, the use of special commands again, there is no need to enter the user password again.
At the same time, Sudo provides powerful log management, detailing what each user has done.
sudo user management is stored in the file:/etc/sudoers. In other words, if you want to add a user to the Sudo user base, you need to configure the file yourself, and you need root permission to read and write this file.
1.2 Adding a user to the sudo group when using sudo, if "DBA is isn't in the sudoers file" appears. This incident would be reported. " Description Current user name: DBA does not have permission to use sudo, this time we need to modify/etc/sudoers to add sudo permissions to the current user DBA.
[[email protected] ~]$ sudo yum-y Updatewe Trust you had received the usual lecture from the local systemadministrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) with great power comes great responsibility. [sudo] password for DBA:DBA isn't in the sudoers file.
- Use the "su–" command to enter the root user;
- Add Write permission to the sudoers file: Use the command "chmod u+w/etc/sudoers"
- After executing the visudo command, press "I" to enter edit mode, find "root all= (All) All", add: "DBA all= (All) Nopasswd:all", then click "ESC" key to exit edit, after "Wq" (write quit) , Exit Sudoers. Ss
- Enter "chmod u-w/etc/sudoers" To remove the Write property of the file
- When you switch back to your users with "exit" and then use the sudo whoami command, if you return root, you can use the
Add normal users to the sudo group under CentOS and password-free login