Introduction
By the default set of module in various of distributes UNIX-like systems have Discretional Access Control on the panel for control permission. That mean every user of the system have own rights and access to processes and files. Highlight, in Linux is pretty more things could be a file: devices, common file, directories, links and etc. For that type of data we manage attributes of the file, which contain: owner, group, size, type data. By the first and second parameters we can track who has access and rights to change permission.
Requirements
- Root rights;
- Debian 12 or higher version;
- Several knowledge about work OS ;
- Internet connection.
Permission and attributes on Linux
In Linux we can check attributes and permission by the command below:
ls -l
But if we want to look at attributes single file, that you need type command below:
ls -l /etc/network/interfaces
Let's be clear and explain every parameter in that screen:
- At the first we can see set of triplet, that indicate permissions assign to the chosen file. First dash means that common file, but that sign could be like a d or l symbol. That mean directories and link accordance;
- Second parameter is next three sign rw- which accordance to owner right: read, write and execute, therefore next triplet for owner' s group and other users;
- Number 1 means quantity of hard links;
- The attribute root root indicate owner and their group;
- Next we can see size of file in bytes, data of last changes and name of file.
Each individual file is associated with a single user (owner) and a designated group. When a file is created, the person creating it becomes its owner, and a particular group is allocated to that file. Linux divides permissions into three primary categories: user, group, and others. Each category can receive separate permissions for reading, writing, and executing. These permissions can be modified using the chmod utility, provided the user has the necessary authorization and explicit permissions to do so.
Permissions also can be represent like sum of numbers. That we use for assign permission: 4 - for read, 2 - for write and 1 for execute:
chmod 755 interfaces
However, if our intention is to completely prohibit all forms of access for all categories of users, we must enter the following command:
chmod 000 interfaces
The chmod command is utilized for altering permissions and supports both symbolic and numeric representations. For example, when using chmod u+w filename, it grants the owner write permission. In this context, u signifies the owner, g is assigned to the group, o represents others, and a encompasses all users. Afterward, the +, -, or = signs are used to respectively add, remove, or explicitly define permissions for users.
chmod u+rwx interfaces && chmod go-rwx interfaces
Or we can use equal command:
chmod u=rwx, go= interfaces
If you want to save write permission for other and group users, but you need protect them from delete, then use command below:
chmod +t interfaces
Conclusion
This journey has unraveled the complexities of permissions and attributes in the Linux realm. Mastery of these concepts is crucial for maintaining data security and effective system administration.