Updated on Apr 23, 2018
The tree-like hierarchy of Linux, is a multi-user one, which creates the necessity for permissions, with whom one can limit what each user can do to the system. In this tutorial we will review the matters of what permissions are, how they determine what a user can do, and how they indicate the type of the file. We will also review what user groups are, what kind of users there are, and how to change the user and a group of a file.
What you will require in order to fully benefit from this tutorial, will be to have some basic understanding of what the terminal is, how to connect to it, what the shell prompt is, and how to execute commands on it in order to fulfill a certain task. If have been keeping up with our tutorials, you should have a good understanding on the listed things, otherwise if you don't think you have the required knowledge, you can check our previous tutorials which will quickly get you up on track.
Also if you are currently lacking in the web server department we will be happy to provide you top notch hosting with great support.
Let's begin with users and groups, before we dive into permissions. In Linux a system can have many users, but few can modify the core files of the system, that is determined by the user's privileges, and the type. We must note that there are two types of users: system users and regular users. System users are users that are used for executing non-interactive processes, also referred to as background processes, on the other hand regular users are the opposite of system users, they are used for logging in to the server, and executing processes interactively.
If you want to see all of the users on a system, that can easily be done by extracting the information contained in the
/etc/passwd file. In that file every line indicates information about one user. The username can be found at the beginning of the line and it's end is marked by a semicolon(;).
So far we have seen two types of users, but there is also a third type of user, called the Superuser (also known as the root). The root is not restricted by the file's user or group ownership, or by the permissions that are set, he can perform changes and change the permission and ownership of a file, he can change the permissions of the file's users as he pleases. It is possible to configure regular users to have superuser rights. Furthermore, it is considered a good practice to give sudo (superuser) privileges to regular users for administration tasks.
Users can be collected in groups. Groups are merely a convention made to assist the user in allowing access to a dedicated group of users, rather than everyone else having access to the file. A group can be consisted of 0 or more users, and each user can participate in as many groups as he wishes. A way to see all of the groups on the current server is to view the contents of the group file located in the path