4/12/2020

File Permissions system in Linux

** File Permissions system in Linux


`` User

- Owner of the File

- User also called an Owner


`` Group

- User-group can contain multiple users.

- All users in the group have the same file permissions.


`` Other

- Any other user who has access to a file

- Does not own the file

- Does not belong to a Usergroup


--------------------------------------------------------


- r = read permission

- w = write permission

- x = execute permission

- - = no permission


--------------------------------------------------------

`` Changing file / directory permissions

- chmod permissions filename

- Stands for 'change mode'.

- Using the command, we can set permissions (read, write, execute) on a file/directory for the owner, group and the world.


`` Absolute(Numeric) Mode

- 0 : No Permission : ---

- 1 : Excute : --x

- 2 : Write : -w-

- 3 : Excute + Write : -wx

- 4 : Read : r--

- 5 : Read + Excute : r-x

- 6 : Read + Write : rw-

- 7 : Read + Write + Excute : rwx



`` Symbolic Mode


- + : Adds a permission to a file or directory.

- - : Removes the permission.

- = : Sets the permission and overrides the permissions set earlier.


- u : user/owner

- g : group

- o : other

- a : all


`` Changing Ownership and Group

- chown user

- chown user:group



`` Tips on Usergroups

- /etc/group

- Command 'groups'

- Command 'newgrp'