1. Home
  2. Linux
  3. Linux File Permissions
  4. Linux – chmod

Linux – chmod

Linux chmod command

Linux chmod command is used to change access permissions of files and directories. In this article, you will learn how to change permissions of any file or directory with chmod command. We have already described the Linux file permissions.




chmod 755 filename

You can use -R to change permissions recursively.

chmod -R 755 /var/www/html

There are two ways available to change file permissions on Linux. First is Symbolic Notation and second is octal notation. Both are described below:

Using Symbolic Notation:

Just for the reminder, the following symbols are used for file permissions. Here roles are User(u), Group(g), Others(o) and the permissions are Read(r), Write(w), Execute(x).

You can combine any symbols to set permission together like User+Group (ug), User+Group+Other (ugo), User+Other(uo).

Similarly, you can do the same with permissions like Read+Write (rw), Read+Execute (rx), Read+Write+Execute (rwx).

User => Read + Execute

chmod u+rx filename

User + Group => Read + Execute

chmod u+rx,g+rx filename

chmod ug+rx filename

User => All, Group => Read + Execute, Other => Read

chmod u+rwx,g+rx,o+r filename

User => All, Group + Others => Read + Execute

chmod u+rwx,go+rx filename

All permission to everyone (not recommended)

chmod ugo+rwx filename

Using Octal Notation:

Using the octal notation you can set permissions in number between 0-7. Each number is calculated with the sum of read (4), write (2) and execute (1).

For example, if you set permission 6, it means 4+2 (read + write). If you set permission 5 means 4+1 (read + execute).

The permissions are set in a sequence user, group, others. For example if you set permission 754, it means user => 7, group => 5 and other => 4.

Let’s have some examples.

User => read+write+execute, Group => read+execute, Other => read

chmod 754 filename


  • 7 is for user is combined with read-4 + write-2 + execute-1
  • 5 is for group is combined with read-4 + execute-1
  • 4 is for other is read-1 only.

User => read+write, Group => read+write, Other => read

chmod 664 filename
Tags ,
Was this article helpful to you? Yes 2 No