≡ Menu

Chmod Numeric Permissions Notation UNIX / Linux Command

Can you provide more information about chmod command octal mode number notation?

The command chmod changes the file mode bits of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new mode bits. chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.

UNIX / Linux chmod command

A bit mask created by ORing together zero or more of the following:

Octal Mode NumberDescription
0400Allows the owner to read
0200Allows the owner to write
0100Allows the owner to execute files and search in the directory
0040Allows group members to read
0020Allows group members to write
0010Allows group members to execute files and search in the directory
0004Allows everyone or the world to read
0002Allows everyone or the world to write
0001Allows everyone or the world to execute files and search in the directory
1000Sets the sticky bit
2000Sets the setgid bit
4000Sets the setuid bit

First digit in the above mode number is used to set setuid, setgid, or sticky bit. Each remain digit set permission for the owner, group, and world as follows:

  1. 4 = r (Read)
  2. 2 = w (Write)
  3. 1 = x (eXecute)

So you end up creating the triplets for your user by adding above digits. For e.g.

  • To represent rwx triplet use 4+2+1=7
  • To represent rw- triplet use 4+2+0=6
  • To represent r– triplet use 4+0+0=4
  • To represent r-x triplet use 4+0+1=5

To only give full permission to user, use it as follows:
chmod 0700 file.txt

  • 0 – Use set setuid, setgid, or sticky bit
  • 7 – Full permission for owner (rwx = 4+2+1=7)
  • 0 – Remove group permission (— = 0+0+0=0)
  • 0 – Remove world permission (— = 0+0+0=0)
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 10 comments… add one }
  • Tsakos December 18, 2009, 11:35 am

    To represent r-x triplet use 4+0+1=1 – It should be 5, not 1. :-)

  • nixCraft December 18, 2009, 3:19 pm


    Thanks for the heads up!

  • Pokermu November 4, 2010, 1:07 pm

    Thank you. It opened my eyes wide.

  • Dinesh February 10, 2011, 7:41 am

    Very Good Explanation It helps me a lot

  • hari July 22, 2012, 11:21 am

    what are the permissions for the chmod 000 hari consider the hari file was exited

  • Mohammed July 24, 2013, 6:49 pm

    Very useful & Informative.

  • petr August 20, 2014, 7:49 am

    i stumble on problem when I set setuid and setgid bits, but no matter what I do I cannot undo them with number semantic…:

    # ls -l
    drwsrwsrwx 2 abc abc 2 18. srp 16.37 directory

    # chmod 0000 directory
    # ls -l
    d–S–S— 2 abc abc 2 18. srp 16.37 directory

    Can someone help? I could do chmod ug-s which works, but I always used number semantic and want to know how to resolve this with them.


  • AHMAD January 5, 2015, 5:16 pm

    LS -L

  • AHMAD January 5, 2015, 5:17 pm

    chmod a+x filename

  • haseeb azimi February 6, 2016, 10:00 am

    Access Class Operator Access Type
    u (user) + (add access) r (read)
    g (group) – (remove access) w (write)
    o (other) = (set exact access) x (execute)
    for example: chmod a+r myfile

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , , ,