Linux borrowed a lot from its mentor UNIX, and one of what was borrowed is the idea that everything in the OS (hardware and software) is represented by a file (yeah…you’d get the sense of if as you progress so don’t bug your brain ’bout this). Majorly because of this reason file ownership and permissions is something that is very important to the normal working of the operating system and its administration – hence should not be overlooked by any Linux user.
Every file on the Linux has a set of accompanying set of permissions based on ownership. But before we delve more into file permissions let get some grasp of file ownership in Linux. These ownerships are grouped into three; the “owner”, the “group”, and the “others”.
- File owner:
The user who creates a file is said to be its “owner”. The owner of the file has full privileges and can p[perform any operation on the file such copying, moving, editing or deleting it. In Linux it is usually represented with a “u”.
- Group Owner:
Because Linux is an OS where there are usually a situation where a system is accessed or used by more than one person it is possible to create a group of users who would share files with one another, any file created by each member of that group belongs to the group. To drive home the point let me illustrate:
Let’s say a project team of five people from XYZ Inc. is working on a software development project for a client. An analyst heads the team. The other four members are programmers. The team is working on a Linux system. Each programmer has been given a program module to develop. The data provided by the client is highly confidential, so the data file is stored in the analyst’s HOME directory. One programmer may have to link a program module to that of another programmer in the team in order to test it. In this situation each programmer is the file “owner” of his program module files. For them to be able to access and link each other’s file, they have to also belong to the same team or group. So we can say the programming team is the “group” owner of the files. The group ownership system is denoted by “g”.
- Other owner:
In the XYZ Inc. all users of the OS who are not members of the project group are referred to as “others” in terms of ownership. And hence they are given lesser privileges when it comes to handling files of a group they are not member of. And this ownership style is denoted with the “o”.
These various groups above have their peculiar privileges (permissions) available to them as they use files and directories on the Linux system. These permissions form the basis for security under Linux. And each file/directory permission can be designated as read, write and execute for all the different user categories on the system.
You can view the detailed permission for a files in your current location by using the command:
Or you could simply just create a new file using the touch command before using the command like this:
ls –l file
Looking at the output from the command, the information present from left to right are;
- The first character is the type of file created; a ‘—’ designate a plane file while a “d” shows its a directory (folder).
- Permissions: read(r), write(r) and execute(x) permissions for the different users of the system.
- Number of links to the file
- The owner: the user that created the file.
- The group: users that are allowed to access the file.
- File size in bytes
- Creation date (or last modification date)
From Fig1.2 you can see the permission information of the newFile we created as;
The first ‘—‘ indicates it’s a file.
The rw- indicates that the owner (creator) of the file has a read and write permission (he/she can view and edit the file).
The r—- indicates that the group ownership is just to read, which is same with any other user.
In a subsequent post I would show how we can assign and modify permissions of files and directories. But for now chew on this.
Latest posts by ALEXANDER WAYNE OMOROKUNWA (see all)
- 5 Top Privacy and Security Linux Distributions - September 28, 2019
- How To Enable And Use On-Screen (Virtual) PC Keyboard In Linux. - August 27, 2019
- WebMaker APP: Offline Web Development Play-Ground - August 20, 2019