Skip to content

orisex/linux-file-permissions-portfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Linux File Permissions Portfolio Entry

Scenario Overview

As part of a security task, I was asked to review and correct the permissions of files and directories within the /home/researcher2/projects directory. This involved checking which users (owner, group, or others) had access to read, write, or execute files, and modifying permissions where needed to follow the principle of least privilege — giving only necessary access to the right people.

Check current directory permissions

I started by using the command:

 ls -l 

This listed all files in the projects directory along with their current permissions. The permission string format looks like this:-rw-rw-r-- 1 researcher2 research_team ...

The first 10 characters tell you:

If it’s a file (-) or directory (d)

The read/write/execute rights for: user, group, and others

Remove write access for others

One of the files, project_k.txt, had the following permissions:-rw-rw-rw- This meant others (all users on the system) could write to the file, which is a security risk. I fixed it with:

 chmod o-w project_k.txt 
Now only the user and group can write to it.

Remove group access from sensitive files

The file project_m.txt is considered restricted, and only the user should be able to read or write it. Originally, it had these permissions: -rw-r----- To remove group read access:

 chmod g-r project_m.txt 
Now, only the file owner can read or write the file, which follows the principle of least privilege.

Check for hidden files

I used:

 ls -la 
This revealed a hidden file named .project_x.txt. Hidden files begin with a dot (.), and ls alone wouldn’t show them.

Set read-only access for user and group

I changed the permissions of .project_x.txt to allow both the user and group to only read (no writing):

 chmod u=r,g=r,o= .project_x.txt 
This makes the file readable by user and group, but safe from accidental edits or misuse.

Change directory permissions

The drafts directory had the following permissions: drwx--x--- This meant the group had execute (x) access — meaning they could enter the directory, which wasn't necessary. The others already had no access, so I only needed to remove execute permission for the group:

 chmod g-x drafts 
This made the directory accessible only to the user.

Key Takeaways

The ls -l and ls -la commands are essential for reviewing file permissions and checking for hidden files. The chmod command lets you remove, add, or set permissions for user (u), group (g), and others (o). The principle of least privilege is critical: only give access where it’s needed.

Screenshots

final-permissions-review-1 final-permissions-review-2

About

A hands-on demonstration of managing file permissions in Linux using chmod and ls commands.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published