News
Seven days of Black Friday madness — great deal from Serverspace!
Serverspace Black Friday
RF
August 25, 2023
Updated August 22, 2023

Linux chmod command

Linux Security VPS

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
List of attributes
Screenshot №1 — List of attributes

But if we want to look at attributes single file, that you need type command below:

ls -l /etc/network/interfaces
Single file attributes
Screenshot №2 — Single file attributes

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 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
Numeric chmod
Screenshot №3 — Numeric chmod

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
Numeric deny
Screenshot №4 — Numeric deny

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
Chmod symbolic
Screenshot №5 — Chmod symbolic

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.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.