Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Create New sudo Users

In a proper production environment, not every user that needs elevated privileges for a server will have the `root` password. Instead, those users that need to perform system administrative tasks would be granted the ability to use the `sudo` command when elevated privileges are needed. This learning activity will provide an opportunity to create new users that will be granted varying degrees of `sudo` access.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Beginner
Last updated
Sep 18, 2025
Duration
1h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create two new users.
    1. Create two new users on the system, and assign the avance user to the wheel supplemental group:
       sudo useradd -m gfreeman
       sudo useradd -G wheel -m avance
    
    1. Set the password for both accounts to LASudo321:
       sudo passwd gfreeman
       sudo passwd avance
    
  2. Challenge

    Verify the `/etc/sudoers` file and test access.
    1. Using the visudo command, verify that the /etc/sudoers file will allow the wheel group access to run all commands with sudo. There should not be a comment (#) on this line of the file:
        %wheel  ALL=(ALL)       ALL
    
    1. From the cloud_user login, use the su (substitute user) command to switch to the avance account, and use the dash (-) to utilize a login shell:
        sudo su - avance
    
    1. As the avance user, attempt to read the /etc/shadow file at the console:
        cat /etc/shadow
    
    1. As a regular user, avance does not have sufficient privileges to do so. Rerun the command with the sudo command:
        sudo cat /etc/shadow
    
    1. After you have verified that avance can read the /etc/shadow file, log out of that account:
        exit
    
  3. Challenge

    Set up the web administrator.

    Now we need to configure gfreeman's account to have the ability to restart or reload the web server when needed. Since he will be the webmaster, he needs sudo permissions to restart the service.

    1. First, create a new sudoers file in the /etc/sudoers.d directory that will contain a standalone entry for webmasters. Use the -f option with the visudo command to create this new file:
        sudo visudo -f /etc/sudoers.d/web_admin
    
    1. Enter in the following at the top of the file. This will create an alias command group that we can apply to any user or group that we add to this file. This group of commands will contain the necessary commands for restarting or reloading the web server:
    Cmnd_Alias  WEB = /bin/systemctl restart httpd.service, /bin/systemctl reload httpd.service
    
    1. Add another line in the file for gfreeman to be able to use the sudo command in conjunction with any commands listed in the WEB alias:
        gfreeman ALL=WEB
    
    1. Save and close the file.

    2. Next, log into the gfreeman account:

        sudo su - gfreeman
    
    1. Attempt to restart the web service:
        sudo systemctl restart httpd.service
    
    1. Now gfreeman can restart the web server. As the gfreeman user, try to read the new web_admin sudoers file with the sudo command:
        sudo cat /etc/sudoers.d/web_admin
    

    Since the cat command is not listed in the command alias group for WEB, gfreeman cannot use sudo to read this file.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight