TimCS.Co.Uk Linux Linux Guides A Basic Guide To Understanding Permissions In Linux/Unix
A Basic Guide To Understanding Permissions In Linux/Unix


Understanding permissions in Linux/Unix

Introduction to Permissions

Permissions are a major part of Linux/Unix and can be used to control the system. In essence they allow or disallow a user, or a group of users, to run a program, edit a file, create a new file,create a directory or even move into a directory. This is a very useful function to have, however understanding the way in which they work and how to set them in Linux/Unix can come across to be daunting.

Do not panic! this guide will attempt to make the understanding of how these permissions work and how to set them a little easier. In order to allow the change of any permissions in Linux/Unix requires the administrator. The user name for the administrator in Linux or Unix is root . Depending on the system being used, the root user password will vary. Some systems do not allow direct access to this user, so instead to operate as root ,a command has to be issued, in order to do so.

N.B. As this guide is more based on using permissions and not understanding how to operator as root , it assumes that this access is readily available. In order to use this guide , the root user is required. If this access is unavailable, then the guide can only be used as a reference. However it is preferred to have this access to have a better understanding of permissions, to have access to the root user please consult your system administrator.



Understanding Permissions

First of all lets display a list of files/directories to see the current permission settings. To do this type ls -l , on my system I was in the root users home folder and the following appeared:

permissionslist

 

There are other files in this folder but these are hidden files and are not recommend to alter. The -l tells the ls command to show the permissions, file size, date/time and file/folder name. The most important part to look at here, is the first section :

permissions

 

This setting of permissions means that the user who has created the file, in this case root , is the only user that can read and/or write to this file.

To understand this further lets go through how this works. The following table illustrates each section of the permissions bar :

The First dash represents the type. In this case the type is a file, as it shows as the single dash. The other types are d for directory and l for a symbolic link The second three dashes represent the owners rights to the file. In this case the ownership is (r)ead and (w)rite. The other setting is the e(x)ecute mode, which tells the system that this file can run as a program and can also control whether a directory is accessible. So if all three were set it would show as rwx . The third set of dashes are for the users that are part of the group that the owner belongs to. In this case the group is root . At the moment on this file there are no allowed permissions hence the three dashes. The permission types are identical to those mentioned for the owner The final three dashes are permissions for users who are not the owner, nor part of the group that the owner belongs to. This section can be known as other or the rest of the world. Again on this file, no permissions are set and again, the types are as mentioned earlier in the ownership section.
- rw- --- ---



 

Powered by Joomla!. Valid XHTML and CSS. Credits go to Gareth Flowers for his help with this site.