Linux file permissions in a nut shell
There are 10 characters governing all Linux files.
They will look something like this
drwxr-xr-x
The first of these 10 characters is the file type. This may be one of the following:
‘d’ for directory
‘l’ for symbolic link
‘-’ for normal files
’s’ for a socket
‘p’ for a pipe
‘c’/'b’ for device files (character & block)
The other 9 characters govern the file permissions. These 9 characters are made up of 3 sets of 3, in order, user permissions, group permissions and other permissions.
Each block of permissions consists of 3 fields, read, write and execute. The read field can only contain a ‘r’ or a ‘-’ , ‘r’ being for read. ‘-’ means that there is no permission, as is true across all of the fields. In the write field you can use ‘w’ or ‘-’, ‘w’ standing for write (allowing a file to be edited). Finally is the execute column which determines whether a file or program can be run or not. This file accepts either a ‘e’ for execute or a ‘-’. It also accepts ’s’ but we need not worry about that.
You may also come across file permissions in numeric form. They look complicated but are easy to decipher. Normally you will find a 3 digit number, each one corresponding to user, group, other. Actually it is treated as a 4 digit number with a leading 0 (we don’t need to worry about that though).
Each digit is made from adding the following numbers
0 - ‘-’ no permission
1 - ‘x’ execute
2 - ‘w’ write
4 - ‘r’ read
For example 7 = 4 + 2 + 1, therefore it stands for read, write and execute.
If we were to use 766 it would mean that all users could read/write the file but only the original user can execute it. It is the same as rwxrw-rw-
Have fun with your brand new file permission wizardry!
George Bunyan
Related Stories
POSTED IN: General
0 opinions for Linux file permissions in a nut shell
No one has left a comment yet. You know what this means, right? You could be first!
Have an opinion? Leave a comment: