Skip to main content
OpenpassAI

Free tool · No sign-up needed

Linux File Permissions Lab

Fix a web app’s files with chmod and chown: lock down a config file, make a script executable and hand the folder to the right owner.

Last updated

Linux command line · Beginner · About 10 minutes

The scenario

You’ve joined the operations team that looks after a small web app on the server web01. Last night’s deployment left the app folder in a bad state: the configuration file that holds the database password can be read and changed by every user on the machine, the deploy script can’t be run, and everything belongs to root instead of the web server’s own account.

Put it right from the command line. The app lives in /srv/app.

A practice Ubuntu terminal that runs in your browser. It understands real commands, and nothing you type can break anything.

Your tasks

0 of 5 done
  1. List the files in /srv/app with their permissions and owners. (not done yet)

  2. Give /srv/app and everything in it to the web server: owner www-data, group www-data. (not done yet)

  3. Set config.env so its owner can read and write it, its group can read it, and nobody else can open it (mode 640). (not done yet)

  4. Make deploy.sh runnable by its owner and group, with no access for others (mode 750). (not done yet)

  5. The logs folder is open to every user. Close it to everyone but its owner and group (mode 770). (not done yet)

student@web01Practice terminal · simulated
Practice terminal: real commands on a simulated Ubuntu server. Type help to see what it knows.
 

Take it further in OpenpassAI

More labs for the certification you’re studying

OpenpassAI’s Hands-on Labs put you in a Linux or Windows terminal for the certification you’re studying, in guided, hint-only and timed modes.

About this lab

What you’ll practice, and where it’s tested

What you’ll practice

  • Reading permissions with ls -l
  • Changing owner and group with chown
  • Setting modes with chmod, in numbers or letters
  • Using sudo for what your own account can’t do

Exams it helps with

Free performance-based questions: Linux+, A+ Core 2, Server+

Walkthrough

One way to complete the lab, with the reason for each step. Try it yourself first.

Show the worked solution
  1. 1Look at what you’re starting from.ls -l /srv/app
  2. 2Hand the folder and its contents to the web server’s account.sudo chown -R www-data:www-data /srv/app
  3. 3Lock down the file with the database password.sudo chmod 640 /srv/app/config.env
  4. 4Let the owner and group run the deploy script.sudo chmod 750 /srv/app/deploy.sh
  5. 5Close the logs folder to other users.sudo chmod 770 /srv/app/logs

Guide

How to get the most from a lab

Read the scenario first

Each lab starts with a situation, the way a ticket or an exam question does. Work out what is being asked before you type anything.

Type the commands yourself

Typing a command, getting it wrong and fixing it is what makes it stick. Use the hints when you’re stuck, not before.

Check the walkthrough afterwards

Every lab has a worked solution with the reason for each step. Read it even when you finished: there is often a shorter way.

Do it again from memory

Reset the lab a day later and do it without hints. If you can, you know it. If you can’t, you’ve found what to study.

FAQs

Got Questions? We’ve Got Answers.

Find quick answers or contact our support team.

Is this a real Linux machine?

No. It’s a practice terminal that runs in your browser. It understands the real commands the lab needs, and many more, and it answers the way an Ubuntu server would. It isn’t a full operating system: nothing is installed, and nothing you type can break anything.

Which commands does the practice terminal understand?

The everyday ones: ls, cd, cat, grep, awk, sed, sort, uniq, find, chmod, chown, useradd, usermod, passwd, systemctl, journalctl, ip, ping, dig, ss and ufw, with pipes, redirects and sudo. Type help in the terminal for the full list. Text editors and package installs aren’t included.

Which exams does this lab help with?

It practices skills from CompTIA Linux+ (Security), CompTIA A+ Core 2 (Operating Systems) and CompTIA Server+ (Security and Disaster Recovery).

Do I need an account?

No. The labs run in your browser and nothing is saved. Sign up only if you want OpenpassAI’s full labs and progress tracking.

Ready to Get Certified Faster?

Start free today or see it in action first.

OpenpassAI

Hi 👋 I’m OpenpassAI. Ready to prepare for your exam the smarter way?

Ready to explore OpenpassAI? I can show you how the platform helps you prepare, practice, and pass.