Linux Permissions for the dazed and confused...

Last Edit: December 12, 2014

Most of my career to this point has revolved around Windows, with just enough Linux/Unix experience to get around a system and REALLY goof things up. So, I wanted to post something I put together from multiple sources to better explain how the whole permissions thing works on files in Unix.

Unix Permissions


# rwx explaination

        read    (r)     4
        write   (w)     2
        execute (x)     1

# numeric calculation of permissions

        7 = 4+2+1       (r-w-x)
        6 = 4+2         (r-w)
        5 = 4+1         (r-x)
        4 = 4           (r)
        3 = 2+1         (w-x)
        2 = 2           (w)
        1 = 1           (x)

# EXAMPLE - change permissions on a file

        chmod 755 somefile.txt

# EXAMPLE - take/give ownership of a file

        chown  somefile.txt

There are some nuances in syntax from one Unix flavor to another, but these should give an idea of what it all means.

NOTE 1: Root has full permission and access to ALL files.
NOTE 2: The creator of a file has full permission and access to THAT file.