File Permissions in Linux
This lab comes from the Google Cybersecurity Certificate. A fictional organization’s research team needs certain files and directories to have updated permissions in order to reflect the level of authorization that should be given. Checking and updating these permissions will keep their system secure.
Check File and Directory Details
The following code determines the existing permissions set for the projects directory:
The command “ls-la” returns a detailed listing of the file contents that also includes hidden files with their respective permissions.
Describe the Permissions String
The 10-character string can be broken down to determine who is authorized to access the file and their specific permissions:
- 1st character: This is either “d” or a “-” indicating the file type as either a directory or a regular file.
- 2nd-4th characters: These indicate the read “r”, write “w”, and execute “x” permissions for the user. Hyphens indicate that the permission is not granted to the user.
- 5th-7th characters: These indicate the read “r”, write “w”, and execute “x” permissions for the group. Hyphens indicate that the permission is not granted to the group.
- 8th-10th characters: These indicate the read “r”, write “w”, and execute “x” permissions for other. Hyphens indicate that the permission is not granted to other.
Get Hunter Hall’s stories in your inbox
Join Medium for free to get updates from this writer.
Change File Permissions
The organization determined that other should not have write access to any of their files. Because “project_k.txt” gave write access to other, I used the “chmod” command to remove it.
The “chmod” command changes permissions on files and directories with the first argument indicating the permissions to be changed and the second argument specifying the file or directory.
Change File Permissions on a Hidden File
The research team archived “project_x.txt” as a hidden file because they did not want anyone to have write access to it. They still want user and group to have read access. The following code shows how I used Linux commands to apply the appropriate permissions:
Change Directory Permissions
The organization wants the user to have access to the drafts directory, meaning that no one other than the user should have execute permissions. The following code demonstrates how I used Linux commands to change the permissions:
Summary
I changed multiple permissions using Linux commands in order to match the level of authorization the organization wanted for files and directories in the projects directory. By starting with the “ls-la” command to check the permissions, I was able to inform my decisions in the following steps while using the “chmod” command to change permissions to the specified authorization.





