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

Finding Files, and Assigning Permissions and Ownership

Knowing how to work with files in Linux is an integral part of being a sysadmin. We need to be able to find them, give and revoke permissions on them, and assign or reassign ownership. This hands-on lab is going to give us some practice doing all of those things.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Aug 23, 2025
Duration
15m

Contact sales

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

    Find Custom Application Files under /opt/myapp and Display a Detailed Listing of Them

    We're going to need elevated privileges for this lab, so once we're logged in let's just become root right off with sudo -i.

    Use the find command to provide a detailed listing of the /opt/ directory:

    find /opt
    

    Our myapp directory is sitting in there, now let's see what happening in there as far as files go, like who owns them:

    find /opt/myapp -ls
    

    The root user owns everything. That's not good. We've got to change that.

  2. Challenge

    Change the /opt/myapp Directory to be Owned by the cloud_user and the Group devop

    Use the chown command to change user ownership to the cloud_user and the group devop for the /opt/myapp directory and its contents:

    find /opt/myapp -exec sudo chown cloud_user:devop {} \;
    

    To test, run find /opt/myapp -ls again, and see if our chown command actually changed ownership on these files.

    It worked. Now we've got some permissions problems though.

  3. Challenge

    Set Permissions for /opt/myapp Files

    Use the chmod command to set rw-rw----, or 660, permissions on all /opt/myapp files, except for the directory itself and the /opt/myapp/start.sh script:

    find /opt/myapp -name "d*" -ok chmod 660 {} \;
    

    Just type y for each yes/no prompt.

    Next, change permissions on anything that does not start with d (the directory itself and the start.sh script):

    find /opt/myapp '!' -name "d*" -ok chmod 770 {} \;
    

    Again, type y for each yes/no prompt.

  4. Challenge

    Find a Directory under /home Which Is Not Owned by a User or Group

    Use the find command to find any directories in /home files which lack a user and group owner:

    find /home -nouser -nogroup -ls
    
  5. Challenge

    Execute the chown Command with the find Command

    Find files and directories that were owned by devuser:

    find /home -ls
    

    Check for anything that doesn't have user or group ownership:

    find /home -nouser -a -nogroup -ls
    

    Run chown with find to modify files that have no current user or group ownership:

    sudo find /home -nouser -nogroup -exec sudo chown cloud_user:cloud_user {} \;
    

    Check that we got them all:

    find /home -nouser -a -nogroup -ls
    

    See if cloud_user owns them now:

    find /home/devuser -ls
    
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