Every user on the Linux operating system has a unique ID and each user must have a unique user name. Users also have permissions and belong to groups which also have permissions. It can get a little complicated but nothing a few diagrams can’t clear up. Groups make it easier to manage users by grouping them and assigning permissions to the group. To find out which group you are in, open a terminal and enter $ groups You can be in more than one group and these groups have permission to access and perform certain actions. Now enter the following. $ ls -l This will list the file permission in long format so that you can see the file and directory permissions. drwxr-xr-x 2 pi pi 4096 Sep 12 2012 Downloads The folder above is called Downloads with some strange characters at the start. drwxr-xr-x These characters are the permissions and should be read like this. The d character is a flag and is used to indicate if this is a directory. If it is a regular file it will display a -. The next characters are broken up into chunk of 3 blocks. rwxr-xr-x The first 3 characters are the user or owners permissions on this directory and determine what you can do with this directory but what is rwx? Read – Read a file. Write – Write to a file or directory. eXecute – An executable permission on the file. This indicates that as the owner of this directory you can perform read, write and execute actions on this folder. The next 3 characters indicate the group permission applied to this folder. r-x This means that the group can read and execute the file or in this case anything inside the folder. At this point you should be wondering which group? Great but for now keep that group in the back of your mind while I continue to the next block of 3 characters. r-x The final chunk of 3, are left for other users of the system or world. drwxr-xr-x 2 pi pi 4096 Sep 12 2012 Downloads To recap file permissions are used to limit access and are grouped together as follows. Owner – The owner permission apply to the owner of the file or directory. Group – These permissions apply to the group that has been assigned to the file or directory. All other users – These permissions apply to all other world users. Next is the number 2. This indicates how many links there are in this file. This will be explained later. Next is pi. This indicates who owns the file and next to this is also the word pi. This indicates the group that the file belongs to. Only members of the pi group and privileged users are able to view files in this directory. drwxr-xr-x 2 pi pi 4096 Sep 12 2012 Downloads The 4096 indicates the size in bytes followed by the modified date. drwxr-xr-x 2 pi pi 4096 Sep 12 2012 Downloads And finally the directory name Downloads.
|