Linux is based on Unix concept. Linux is a multi-user OS.
It is based on unix concept of file ownership and permissions to provide security, at the file system level. As a basic learner of Linux one must understand the ownership and permissions of files. It will improve security of files and expand knowledge as well.
Study each and everything line carefully to better understand. If you have any problem then post in the comment or tell us if something we've done wrong.
In order to understand Ownership and Permissions of files easily, you are recommended to read the following articles-
What are the Users?
Linux is the Multi-User operating system. In order to learn the ownership and permissions, one must start from Understanding Users. So what are the users?
Linux has to types of users first system users and secondly regular users. As system users run the background proecess on system and regular users help operating system to boot up and run perfectly.
You can easily view all of the users on a system through /etc/passwd file. Each line in this file contains information about a single user, starting with its user name (the name before the first : ). Print the passwd file with this command.
The superuser also called root user is the user that has power to overwrite any ownership and permission of any file. A superuser perform administrative task in the system and can make any changes to the system.
Accept the superuser, other users can also be configured and can be assumed as superuser. The sudo is easy and quick way to perform administrative task with superuser's ability.
What are the Groups?
Simple enough a group contains one or more users.
You can easily view all of the groups and their members through /etc/group file.
It's time to come on our main topic because we're gone through basics.
Viewing Ownership and Permissions
Every file has a single user and single group, and has its own permissions. Take a look at how we can view the ownership and permissions of any file.
Hint: If you are in an empty home directory, and you haven't created any files to view yet, you can follow along by listing the contents of the /etc directory by running this command: ls -l /etc
From the diagram, we know that Mode column indicates the file type, followed by three triads, or classes, of permissions: user (owner), group, and other. The order of the classes is consistent across all Linux distributions.
Let's look at which users belong to each permissions class:
Understanding Read, Write, Execute
What each of the file permission allows users to do? We will see now what each permission means for users.
A touch to the each permissions type:
For a normal file, read permission allows a user to view the contents of the file.
For a directory, read permission allows a user to view the names of the file in the directory.
For a normal file, write permission allows a user to modify and delete the file.
For a directory, write permission allows a user to delete the directory, modify its contents (create, delete, and rename files in it), and modify the contents of files that the user can read.
For a normal file, execute permission allows a user to execute a file (the user must also have read permission). As such, execute permissions must be set for executable programs and shell scripts before a user can run them.
To keep this tutorial simple, we will not cover how to modify file ownership and permissions here.
After reading this article completely you should now have understanding of files ownership and permission.
Submit your topic
More From LinuxAndUbuntu