Skip to main content
In this lesson you’ll apply Linux file system permissions in a practical sequence: create users and groups, assign ownership, and use both numeric and symbolic forms of chmod. The objective is not just to run commands, but to understand how each change affects access control so you can enforce proper policies on a Linux system.
The image is a dark presentation slide titled "Working With Linux File System Permissions." It also shows a simple blue outline icon of a file with code brackets and a padlock, suggesting locked or secured files.
What you’ll learn
  • Create users and groups, and add users to a group.
  • Change ownership with chown (including -R for recursion).
  • Set permissions with numeric chmod (e.g., 640) and symbolic chmod (e.g., g+w, o-rwx).
  • Verify results with ls -l.
Numeric permission shorthand: 6 = read+write (rw), 4 = read (r), 2 = write (w), 1 = execute (x), 0 = no permissions. Example: 640 → owner rw (6), group r (4), others - (0).
Prerequisites
  • You will run the commands as root (prompt shown as root@control:/#). If you are not root, prefix admin commands with sudo.
  • Basic familiarity with the shell and ls -l output is helpful.
Step-by-step demo Run the following commands in order. Explanations follow each section. Create users and a group, then add users to the group:
  • We created three accounts: dev1, dev2, and manager.
  • We created a shared group devteam and appended dev1 and dev2 to it using usermod -aG, which preserves existing group memberships.
Create a project directory and a config file, then set ownership:
  • chown dev1:devteam /project/app.conf assigns the file owner to dev1 and group to devteam.
  • ls -l confirms owner and group: dev1 devteam.
Set permissions so owner can read/write, group can read, others have none (numeric chmod 640):
  • chmod 640 sets owner = rw (6), group = r (4), others = - (0). The ls -l permission display shows -rw-r-----.
Create a second file and apply ownership recursively:
  • When app2.conf was created, defaults gave it owner root:root.
  • chown -R dev1:devteam /project recursively changes owner and group for the directory and its contents to dev1:devteam.
Add group write permission to /project/app.conf using symbolic chmod:
  • chmod g+w adds write permission for the group without changing owner or other bits.
  • app.conf now shows -rw-rw---- (owner rw, group rw, others -) which corresponds to numeric 660.
Remove any privileges from others explicitly:
  • chmod o-rwx removes read, write, and execute bits from others. If others already had no permissions, the state remains unchanged.
Quick reference — common numeric values Commands summary Best practices and warnings
Use chown -R and recursive chmod with care — they can change ownership/permissions for many files at once. Double-check the target path to avoid inadvertently changing system or unrelated files.
Further reading Summary
  • Created users and a shared group, then added users to that group.
  • Created files, set ownership with chown and chown -R.
  • Used numeric chmod (e.g., 640) to explicitly set owner/group/others bits.
  • Used symbolic chmod (g+w, o-rwx) to tweak permission classes without altering other bits.
  • Verified each step with ls -l to confirm ownership and permissions.

Watch Video