Permissions

Explanation for permissions of files.

Permissions can be so granular in Linux, that whilst a user technically owns a file, if the permissions have been set, then a group of users can also have either the same or a different set of permissions to the exact same file without affecting the file owner itself.

Permission Matrix

  • The permissions for a file have 3 categories, owner's permissions, group's permissions, others' permissions.

  • Owner permissions are for the owner of the file.

  • Group permissions are for the users in the same group as the owner.

  • Other permissions are for other users who aren't the owner and not in the same group.

Permission to be assigned

  • You can assign 3 different things for the permissions, read, write, and execute.

  • Read permissions are for reading the file content (Represented with the r letter)

  • Write permissions are for writing to the file (Represented with the w letter)

  • Execute permissions are for executing the file (Represented with the x letter)

The Octal Values

The permissions are represented using 3 numbers, the first number defines the permissions of the owner, the second number defines the permissions of the group, and the third number defines the permissions of others.

Each of the attributes has the following values:

  • Read (r): 4

  • Write (w): 2

  • Execute (x): 1

Changing Permissions:

  • Permissions can be changed using numbers or letters.

Examples:

chmod 625 <File>

  • Permissions Read (4) and Write (2) are provided to the owner.

  • Permission to Write (2) is provided to the group.

  • Permissions Read (4) and Execute (1) are provided to others.

chmod <ugo>+<rwx> <File>

  • u is used to represent the owner.

  • g is used to represent the group

  • o is used to represent others.

  • when a letter is not specified it means to all users (Owner & Group & Others)

Last updated