sudoers
Curtrice is a RHEL Sysdamin at Red Hat. George is a new employee who needs to be added to sudoers on her RHEL system. George has not yet been added as a user, and his username will be georgej. What commands will Curtrice issue to get the task done?
To add a new user, such as georgej, to a RHEL system, Curtrice can use the useradd
command:
sudo useradd georgej
This will create a new user account for georgej. Next, she can set a password for the new user with the passwd
command:
sudo passwd georgej
This command will prompt her to enter and confirm the new password for georgej.
Once the user account has been created and a password set, she can then add the new user to the sudoers file. To do this, she can use the visudo
command to edit the /etc/sudoers
file:
sudo visudo
This command will open the sudoers file for editing. Within the file, she can add the following line to grant georgej sudo privileges:
georgej ALL=(ALL) ALL
This line specifies that the user georgej can run any command as any user with sudo privileges.
Once the line has been added, she can save the changes to the file and exit the editor. George should now be able to use sudo
to execute privileged commands on the RHEL system.