File Permissions, Symbolic Permissions and chmod




 In this blog we will see how we can use file permissions in Linux and we will discuss about symbolic permissions in Linux .

Now lets do a $ ls -l , so that we can see detailed information about files.

The information you get here are permissions for the files .
-rw-rw-r– 1 jeeu jeeu 33 Jan 17 19:34 test.txt

The first ‘ – ‘ on the left hand side means it’s a normal file if it would be d then it will bedirectory or if it would be a character special file then it would be a c or if it would be a b then it would be a binary special file .

The next three element : ‘rw-‘ , for the owner of the file ,and then next three is : ‘rw-‘ for the group of the file so group contains these rights and the last three is for the permission for everybody else .

The next you can see here is ‘1’ and one stands for the symbolic links of the file .Then next is : ‘jeeu‘ , which is for the owner of the file . Next is ‘jeeu‘ ,name of the group of the file .

Now next one is for the size of the file so right now our file size is 33 .Then next is the date on which its created and then the file name .Basically we are interested in thiearea which is the user group and other permissions and the name of the user and the group .

1.To change the permission of the file so there is a utility called chmod which stands to change the permission of the file .So for example , I want to allow the other persons to execute the file (test.txt) , so what I can do is I will just use $chmod which is the utility to change the permission of the file and then I can give the first of all name of others so for example o stands for others and then plus or minus plus is for adding the permission and minus is fo rsubtracting the permission and then the permission itself  . Basic command looks like : $chmod o+x file_name (x is the permission here which is executable) .

2.Now I want to change the permission of the group of the same file and the group already have the permission read and write I want to change it to read write executable so for the group once again we will use chmod and then for Group g and then +x so we will change the permission of the group and the name of the file .Command : $chmod g+x file_name

Now to reduce the permission of group to only , read , we can use : $chmod g-wx file_name

3.Command :$chmod ug=rwx file_name .Now this kind of combination will allow user and group both at once for other permissions , the equal sign will make user and group to read , write and executable . Some other way to use this command : $chmod u+rw,g=rw,o+r file_name .It will give use read and write permission , group also gets read and write permission and others get the read permission .

So this is how you can change the permission .








Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*