[LINUX] Study Note 4 _visudo command can only be used by root users, but sudo can also be used by general users

★ 1 Log in as root rinchome user creation

#Group creation
[root@localhost ~]#groupadd rinchome
#Create user (make group rinchome)
[root@localhost ~]#useradd -g rinchome rinchome
#Change password for rinchome user
[root@localhost ~]#passwd rinchome

★ 2 Log in as rinchome user sudo visudo command execution

#visudo command execution
[rinchome@localhost ~]$ sudo visudo
You should have taken regular training from your system administrator.
This is usually summarized in three points::

    #1)Respect the privacy of others.
    #2)Think before typing.
    #3)Great power comes with great responsibility.

[sudo]rinchome password:
rinchome is not in the sudoers file. This event will be recorded and reported.
[rinchome@localhost ~]$

I couldn't do it with ★ 3 ★ 2, so log in as root Edit visudo

[root@localhost ~]# visudo

Below ↓↓
## Same thing without a password
 %wheel ALL=(ALL)       NOPASSWD: ALL
 
Changed to ↓↓ below
 ## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
 %rinchome      ALL=(ALL)       NOPASSWD: ALL

★ 4 Log in with rinchome Execute the sudo visudo command again and go to the edit screen

[rinchome@localhost ~]$ sudo visudo

## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.

★ 5 Summary

It's an SE, so it's unclear if it's correct

Recommended Posts

Study Note 4 _visudo command can only be used by root users, but sudo can also be used by general users