Understanding how to view and change file permissions in Linux is an important skill to have. Your files and your system could potentially be compromised if certain users can access all of your files. This skill allows you to protect your files and prohibit other users from accessing certain files.

Steps

  1. 1
    Open the Terminal. You will be using the terminal to change file permissions.
  2. 2
    Locate your file. In order to change the permissions of a file, you must be in the directory where the file is located. You can change directories by using the command cd, followed by a space and the name of the directory you want to switch to.
    Advertisement
  3. 3
  4. 4
    Understand the permissions of the file. The file permission string is broken up into blocks. The entities that are files will always begin their permission string with "-". This is shown in the green square. The rest of the permission string (after the "-") represents:
    • Permissions for the owner (e.g., the first three characters ("rw-") in the red square)
    • Permissions for the group owner (e.g., the second three characters ("r--") in the yellow square)
    • Permissions for others (e.g., the last three characters ("r--") in the blue square)
  5. 5
    Find the octal number that matches the permissions you want. Use the chart to find the octal number of the permissions you want the file to have. This octal number will be used in changing file permissions.
  6. 6
    Use the "chmod" command to change the file's permissions. Use chmod followed by the octal number and the file name. In this case, we are changing the permissions of the file "f5". This command will change your file's permissions to the permissions that correspond with the octal number.
  7. 7
    Verify that the file's permissions have been changed. After using the "chmod" command, it is important to make sure the file now has the permissions you want. To view the current file permissions, use the command ls -l. If the permissions of the file have changed to what you want, you have successfully changed your file's permissions.
  8. Advertisement

About This Article

wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, volunteer authors worked to edit and improve it over time. This article has been viewed 12,372 times.
How helpful is this?
Co-authors: 3
Updated: April 4, 2022
Views: 12,372
Categories: Linux
Advertisement