Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

Using File Attributes and Permissions

Both file attributes and permissions determine user and group access to files throughout the file system. Therefore, being able to use file attributes and permissions effectively is an essential system administrator skill. In this Hands-On lab, you will be using commands to view and set permissions and attributes for files. When the lab is complete, you should know how to use file attributes and permissions to control user and group access to files in the file system.

Google Cloud Platform icon

Path Info

Clock icon Beginner
Clock icon 15m
Clock icon Jan 17, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    View the Current Permissions of /opt/myapp/

    Let's see where we stand, as far as permissions go. Run ls -l and stat on the /opt/myapp/ file:

    cd /opt/myapp
    ls -l
  2. Challenge

    Change Permissions on /opt/myapp/ to Allow Full Privileges for User and Group Only

    Currently, the permissions of the file /opt/myapp/ are rw-r--r--, or mode 644. We need the user and group to have all permissions and the others to have none. Using either command will have the same result:

    ls -l
    chmod u=rwx,g+wx,o-r
    ls -l
    chmod 770
  3. Challenge

    Verify That /opt/myapp/ Is Executable

    The permissions of the file /opt/myapp/ should now be -rwxrwx--- or mode 770, and the file should execute. Look at the permissions again to make sure:


    Now let's try running it:

  4. Challenge

    Make the /opt/myapp/ Immutable Using a File Attribute

    The i attribute should appear when we run lsattr on the file:


    If it doesn't, then we've got to set it:

    sudo chattr +i

    Verify that the file is set immutable:


    Note the use of sudo there. We've got to run chattr as root.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans