LINUX PERMISSIONS

From the last text I showed you how to enter data into a file. Sometimes the data you entered could be confidential. Then you don’t like accessing these data by others. Then what can we do to hide these data from the other users. LINUX has a great answer for this. That is file permission mechanism in LINUX.

WHAT IS FILE PERMISSION?

As I mentioned above using LINUX we can restrict others from accessing files in our system. We can give privileges to others to access our file and restrict some other user from accessing the file. There are three user groups in LINUX.

  1. Owner : He is the one who owns the file or who has created it.
  2. Group : The users of a particular group which the file has been assigned to.
  3. Others : The rest of the users of the system, who are not members of the group.

According to those user groups the owners can assign privileges to a a certain file or a directory. Also there are three permission types in LINUX too. The owner can give these permissions to each user group.

  1. r – read – Anyone who has the permission read, can view the file.
  2. w – write – Anyone who has the permission write, can add data to the file.
  3. x – execute – Anyone who has the permission execute, can execute the file.

According to the given permission a particular user can do what they are capable of with a particular file or a directory.

13

This is how the permissions are showed.

drwxrwxrwx

  • The first letter ‘d’, refers that it is a directory. There could be some other letters as well,
    • d – directory
    • – no special permission
    • l – symbolic link (a reference to another file or a directory)
  • Next three ‘rwx’, refers to owners permission regarding the particular file.
  • Next three ‘rwx’, refers to group permission regarding the particular file.
  • Next three ‘rwx’, refers to others permission regarding the particular file.

HOW TO CHANGE PERMISSION?

  • chmod : This is the command used to change permissions. There are few parameters to know. After typing chmod, we should mention the user group to which we are going to change permission.
    • u – owner
    • g – group
    • o – others
    • a – all
  • Then we should say whether we granting or revoking permission to that particular user group.
    • + – Granting permission
    • – Revoking permission
  • The next parameter for the permission type.
    • r – Read
    • w – Write
    • x – Execute
  • At last we can give name of the file or the directory.

11

In the above example I changed the reading permission of  the Owner’s to the myViText file. Now even the owner won’t be able to read the file.

12

Again if we want to grant permission we can reenter the code with +r.

14

Now the Owner will be able to view the file.

15

From this text I tried to show how the file permission mechanism works in the LINUX Operating System. Hope you got some idea about how it works and how we can give permissions to different users for different tasks. See you soon with another interesting topic. Thank You!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s