In this hands-on lab, you will connect to a Red Hat 8 system using SSH. Once connected, you will use the `useradd` command to add several users, set passwords using the `passwd` command, use the `groupadd` command to add a couple of groups, and use either the `usermod` or `gpasswd` commands to add users to groups. Once the groups are in place, you will grant elevated privileges to a set of users using the new groups and test the permissions by using the `su -` command to switch to a user and attempt to run the commands.
*This course is not approved or sponsored by Red Hat.*
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Add 5 Users to the System
- Add the following user accounts to the system. Set the comment option to the user’s full name.
- Peter Gibbons (pgibbons)
- Michael Bolton (mbolton)
- Samir Nagheenanajar (snagheenanajar)
- Milton Waddams (mwaddams)
- Tom Smykowski (tsmykowski)
- Use the
passwd
command to set to the default password ofinitech123
for all users.
- Add the following user accounts to the system. Set the comment option to the user’s full name.
- Add 2 Groups to the System
- Use the
groupadd
command to add the following groups.- devadmins
- helpdesk
- Use the
- Add Users to the New Groups
- Use either the
usermod
orgpasswd
command to add the following user accounts to thedevadmins
group.- Peter Gibbons
- Michael Bolton
- Samir Nagheenanajar
- Use either the
usermod
orgpasswd
command to add the following user accounts to thehelpdesk
group.- Milton Waddams
- Tom Smykowski
- Use either the
- Grant Superuser Privileges Using the New Groups
- Use the
visudo
command to create a new file in the/etc/sudoers.d
directory and call the file20-groups
. - Add the following group configurations into the file
- The
devadmins
group should be able to connect from any host, act as the root user and be able to run any command. - The
helpdesk
group should be able to connect from any host, act as the root user and only run thels
andcat
commands.
- The
- Use the
- Validate Superuser Access for Two of the Accounts, One from Each Group
- Use the
su -
command to switch to one of the users from thedevadmins
group and attempt to run the following commands with elevated (sudo
) privileges.- List the contents of the root user’s home directory
- Use the
cat
command to view the/etc/sudoers
file - Use the
less
command to view the/etc/sudoers
file. - Exit the previous user and return to your account
- Use the
su -
command to switch to one of the users from thehelpdesk
group and attempt to run the following commands with elevated (sudo
) privileges.- List the contents of the root user’s home directory
- Use the
cat
command to view the/etc/sudoers
file - Use the
less
command to view the/etc/sudoers
file.
- Use the