Securing Systems with Users, Groups,
and Permissions150
Using sudo to run admin commandsWe will use the user account in these examples. As you may remember, in Chapter 1,
Getting RHEL Up and Running, we enabled the checkbox in which we requested the account to be the administrator. Under the hood, the account was added to the wheel group, so we can start using sudo to run admin commands.
Let’s login with the user account and try to run an administrative command such as adduser:
[root@rhel-instance
]# su - user[user@rhel-instance
]$ adduser johnadduser: Permission denied.adduser: cannot lock /etc/passwd; try again later.As you can see, we receive a Permission denied error message.
To be able to run it with sudo, we only need to add it to the beginning of the command line:
[user@rhel-instance
]$ sudo adduser johnWe trust you have received the usual lecture from the local SystemAdministrator. It usually boils down to these three things: #1) Respect the privacy of others.Share with your friends: