Changing File Permissions

On computer filesystems, different files and directories have permissions that specify who and what can read, write, modify and access them.

Permission Modes

  7       5     5
 user   group  world
 r+w+x  r+x    r+x
 4+2+1  4+0+1  4+0+1  = 755

The permission mode is computed by adding up the following values for the user, the file group, and for everyone else. The diagram shows how.

  • Read 4 – Allowed to read files
  • Write 2 – Allowed to write/modify files
  • eXecute1 – Read/write/delete/modify/directory
  7       4      4
 user   group  world
 r+w+x    r      r
 4+2+1  4+0+0  4+0+0  = 744

Example Permission Modes

ModeStr PermsExplanation
0477-r–rwxrwxowner has read only (4), other and group has rwx (7)
0677-rw-rwxrwxowner has rw only(6), other and group has rwx (7)
0444-r–r–r–all have read only (4)
0666-rw-rw-rw-all have rw only (6)
0400-r——–owner has read only(4), group and others have no permission(0)
0600-rw——-owner has rw only, group and others have no permission
0470-r–rwx—owner has read only, group has rwx, others have no permission
0407-r—–rwxowner has read only, other has rwx, group has no permission
0670-rw-rwx—owner has rw only, group has rwx, others have no permission
0607-rw—-rwxowner has rw only, group has no permission and others have rwx
See full list 0000 to 0777.

Advertisements

Shashank Gupta has written 2 articles

  • Abhishek

    Nice article. Got my concept cleared. 🙂

  • Rahul Gupta

    Thanks for the tabular representation of all file permission codes. Easy to find and understand all permission codes.

  • Annanya Kashyap

    Very good concept Mr. Shashank.