Your support on Ko-Fi is much appreciated:
👉 https://ko-fi.com/csg_yt
Join our new discord channel:
👉 / discord
Buy CSG Merchandise:
👉 http://tee.pub/lic/csg
This video is based on RHEL 8.
Video to cover the section 'Configure superuser access' for the RHCSA (Red Hat Certified System Administrator).
More information on the required learning: http://bit.ly/rhcsa8
Notes from the video:
A superuser in Linux is managed via the sudoers file, this is a file that stores the list of the users that can escalate their privileges and what they can escalate it to.
Editing that file can only be done by a privileged user and only using visudo if you don’t use that application you can irreparably damage your Linux installation.
visudo /etc/sudoers
If you review the entries in the sudoers file that’s there already, you will see a line that looks like this:
(percentsign)wheel ALL=(ALL) ALL
As there is a % for the first entry that means it is specifying a group that would have access. In this case it is the wheel group.
The format of the entry is as follows:
User Host = (Runas) Command
(percentsign)Group Host = (Runas) Command
Based on this, and the above previously mentioned configuration for the wheel group, we can describe the wheel group access as thusly. The wheel group has access to escalate to the root user and run any command from any host.
To give the user superuser access, we just need to add them to the wheel group, we can do this by:
usermod -aG wheel user1
We can login as user1 to test via:
su - user1
The user1 user can escalate their privileges to root via sudo, for example to escalate their bash shell:
sudo bash
Finally, another example for the sudoers configuration:
user2 ALL=(root) /bin/ls, /bin/df -h, /bin/date
This would allow the user2 user to run from any host the listed commands as root. Any other commands would be blocked.
#rhcsa #rhel #linux #redhat