AWS re/Start Lab · Linux

Managing File Permissions

Learn to manage file and folder ownership matching a company's group structure, and change file permissions using both symbolic and absolute modes.

Lab Summary

Connected via PuTTY (as described in Lab 225). Modified ownership of folders like companyA, HR, and Finance using chown. Created files and updated permissions with both symbolic and absolute chmod modes.

Ownership Management

Used chown -R to recursively set the correct user and group owners for the entire company directory structure.

Permission Modes

Changed file permissions using symbolic letters (g+w) and absolute octal numbers (764).

Step-by-Step Walkthrough

Detailed record of each task performed during the lab.

01

SSH Connection

  • Connected to the EC2 instance via PuTTY following the process described in Lab 225.
02

Change File and Folder Ownership

  • Navigated to the company directory with cd companyA.
  • Changed ownership of companyA to the CEO and Personnel group: sudo chown -R mjackson:Personnel /home/ec2-user/companyA.
  • Changed ownership of the HR folder: sudo chown -R ljuan:HR HR.
  • Changed ownership of the Finance folder inside HR: sudo chown -R mmajor:Finance HR/Finance.
  • Checked the recursive permissions with ls -laR.
The -R flag used with chown means recursive, ensuring both the folder and all its contents get their permissions updated together.
03

Change Permission Modes

  • Created a new file using sudo vi symbolic_mode_file, saved and quit.
  • Modified permissions using symbolic mode to add write access for the group: sudo chmod g+w symbolic_mode_file.
  • Created another file using sudo vi absolute_mode_file.
  • Assigned permissions using absolute octal numbers (read, write, execute): sudo chmod 764 absolute_mode_file.
  • Verified both changes with ls -l.
In the absolute mode 764, the 7 grants the owner full permissions (4+2+1), the 6 grants the group read+write (4+2), and the 4 grants others read-only permissions.
04

Assign Remaining Permissions

  • Changed ownership of the Shipping folder: sudo chown -R eowusu:Shipping Shipping.
  • Changed ownership of the Sales folder: sudo chown -R nwolf:Sales Sales.
  • Validated the changes using ls -laR Shipping and ls -laR Sales.

Command Reference

Commands used in this lab for permission management.

cmd

chown

Changes the ownership of a file or directory for both the user and the group.

  • -R : Applies the changes recursively to directories and their contents
  • user:group : Defines the target user and group in that exact format
cmd

chmod

Changes the file mode bits (read, write, execute permissions).

  • g+w : Symbolic mode adding write (w) to the group (g)
  • 764 : Absolute mode granting Owner(7), Group(6), Others(4) permissions
cmd

ls

Lists directory contents.

  • -l : Uses a long listing format displaying permissions, owners, and size
  • -aR : Lists all files (including hidden) recursively

Key Learnings

What Was Learned

How to change directory logic to match organizational structures assigning group owners using chown.
The use of the -R flag to aggressively change permissions across nested folders recursively.
How to add specific permissions leveraging symbolic mode syntax such as g+w on chmod.
The math behind octal absolute permission arrays like 764.

Technical Conclusion

Proper execution of permissions determines the overall security profile of any Linux environment. Permissions regulate reading, writing, and executing operations for standard users, their respective groups, and unauthorized observers.

Understanding both symbolic and absolute permission modes empowers administrators with the flexibility needed to solve multiple authorization challenges.