How to Change File Permissions in Linux Through the Terminal

Ryan Karolak
Linux/Unix File Permissions

File permissions in Linux are set by the root user, any administrators with access to the root account, or any user with access to sudo. File permissions exist for three types of users: Owner/User, Group, and Others. Each of these users can have three different rights for any particular file. These rights consist of Read, Write, and the ability to Execute the file.

The Read permission allows the user to open and read a file. Without this permission the contents of a file can not be viewed. If the subject is a folder, then the this is permission to list the contents of a folder.

The Write permission allows the user to rite data to a file. This allows folders to rename, add, or remove contents from a folder.

The Execute permission allows files to be executed or run. Examples of executable files includes programs and scripts. In directories, Execute allows the user to enter and access files within the directory.

Viewing and changing file permissions in Linux can be achieved through the terminal, as well as through a graphical file browser such as Konquer.
To view the permissions of all the files in a directory, enter the directory that contains the files you wish to check and type in "ls -l " (without quotes).

Changing the permissions of a file can be done though the chmod command. Chmod can be used either symbolically or numerically.

First, decide which category of users must be changed. Each category is represented by a letter.

u = user (owner)
g = group
o = others

Next, decide if permissions need to be added, removed, or replaced.

+ add
- remove
= replace

Each permission is also represented by a letter.

r = read
w = write
x = execute

Now use letters/characters above in the order given after the chmod command and before the filename to modify permissions. For example, "chmod g+x program.app" (without quotes) gives executable permissions to program.app.

A numerical representation can be used as well. This is represented by three-character numbers. Each position represents a category of user (owner, group, then others.) Each permission is represented by a value which is added up to make the final number.
4 = read
2 = write
1 = execute
only 0 = no permissions

(read + write + execute) each for owner, group, and others.

Therefore, to give a permission value, each are put together. If we wanted to give program.app all permissions for the owner, read and execute for groups, and none for others, we would have:

(4 + 2 + 1) = 7 for owner
(4 + 0 + 1) = 5 for groups
(0 + 0 + 0) = 0 for others

= 750

The command to use numeric permissions on program.app would be: chmod 750 program.app

Published by Ryan Karolak

I'm a college student and am here on AC to share with the world my knowledge and perspective on the world. I'm also trying to make a little money to support my daily expenses. Thanks for visiting and I hope...  View profile

  • chmod is a common command to change file permissions
  • chmod can change permissions symbolically: chmod g+x program.app
  • chmod can change permissions numerically: chmod 750 program.app

To comment, please sign in to your Yahoo! account, or sign up for a new account.