CHMOD Cheat Sheet

Dan Flood Tech Stuff, Unix and Linux 0 Comments

I find myself having to pause and remember exactly what Unix permissions translate to in functionality so posted this handy chart to use. ¬†Unix or any *nix uses octal for permissions – it’s pretty simple once you get the chart into your brain ūüėČ

        PERMISSION      COMMAND EXAMPLE   

         U   G   W
        rwx rwx rwx     chmod 777 filename      
        rwx rwx r-x     chmod 775 filename
        rwx r-x r-x     chmod 755 filename
        rw- rw- r--     chmod 664 filename
        rw- r-- r--     chmod 644 filename

        U = User 
        G = Group 
        W = World

        r = Read
        w = write
        x = execute 
        - = no access

Here’s how the octal numbers break down:

Permissions:

400     read by owner
040     read by group
004     read by anybody (other)
200     write by owner
020     write by group
002     write by anybody
100     execute by owner
010     execute by group
001     execute by anybody

So to manually set permissions, simply add up the columns.  So for example myscript.php you may want: Read,Write,Execute by you, Read,Write,Execute by group, read, execute by world = 400+200+100+040+020+010+004+001 = 775

# chmod 775 myscript.php

 

Leave a Reply