Linux File Permissions


11 Feb 16 - 04:15

The short and the sweet of it.

Very simple. It’s all just a combination of 1, 2 and 4.

-rw-r–r– is probably the most common configuration of the above digits that you’ll see in linux. This is usually displayed as a result of running the command ls -l. If you had to translate it, it would look something like 0644.

rwx

But What Does It Mean?

Let’s break down -rw-r–r– for a moment. The first three characters represent the current user permissions. In this case -rw allow the user to read and write to the file/directory. Summed up, this represents a 6 (4 + 2).

The next three characters are for the current user group. r– allow users belonging to the group read access to the directory. The last three characters refer to “other” which basically includes all other users on the system.

chmod

Let’s run a command to give everyone read/write/execute permissions on a file. Have a look at this example

chmod 777 file.txt

chmod is the application which allows you to modify file/directory permissions. 777 is the result of a sum (1 + 2 + 4). Representing (execute + write + read).



Archives