3 Basic Commands and Simple Shell Scripts Once you have your first Red Hat Enterprise Linux rhel


[root@rhel-instance ]# usermod -aG wheel usertest



Download 1.85 Mb.
View original pdf
Page61/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   57   58   59   60   61   62   63   64   ...   67
Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty - Red Hat Enterprise Linux 9 Administration-Packt Publishing (2022) -chap 3 82 - 180
[root@rhel-instance
]# usermod -aG wheel usertest

[root@rhel-instance
]# groups usertest

usertest : usertest wheel
Important Note
For cloud instances, the account root does not have a valid password assigned. To be able to manage the mentioned cloud instance, in some clouds such as Amazon Web Services (AWS), a user is created by default and added to the wheel group. In the case of AWS, the default user account is ec2-user. In other clouds, a custom user is also created and also added to the wheel group.
To edit the /etc/sudoers file, as happens with other sensitive files, there is a tool that helps not only ensure that two admins are not editing it simultaneously but also that the syntax is correct. In this case, the tool to edit it is visudo.

Securing Systems with Users, Groups, and Permissions
150
Using sudo to run admin commands
We 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 john

adduser: 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 john

We trust you have received the usual lecture from the local
System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.

Download 1.85 Mb.

Share with your friends:
1   ...   57   58   59   60   61   62   63   64   ...   67




The database is protected by copyright ©ininet.org 2024
send message

    Main page