Linux Command - File Permission

Linux makes sure only proper people can have access to the proper files.
/Linux-Command-File-Permission/

Permission

Permission Groups

  • User(u) - unique user
  • Group(g) - A collection of one or more users.
  • Others(o) - others

Access levels

  • Read(r) - permission to read the contents of the file
  • Write(w) - permission to write or modify a file
  • Execute(x) - permission to execute a file

To View Permission, use ls -l command

sample output

1
2
total 4.0K
-rw-r--r-- 1 jimmy root 5 Dec 24 18:13 file1
  1. the first character indicate it is a regular file
  2. the following set of three characters(rw-) indicate owner(in this case jimmy) has read write permission
  3. the next set of three characters(r–) indicate group(root) has read permission
  4. the next set of three characters(r–) indicate everyone has read permission

It is sometimes easier to use an octal number to prepresent the bit patterns

  • r = 4
  • w = 2
  • x = 1

so for rw-r--r--, the octal representation is 644.

Reference