Source: UNIX / Linux: Beginners Guide to File and Directory Permissions
Unix file and directory permission is in the form of a 3×3 structure. i.e Three permissions (read, write and execute) available for three types of users (owner, groups and others).
Three file permissions:
Change File and Directory Permissions Using Chmod Command
You can use either the octal representation or symbolic representation to change the permission of a file or directory.
Octal representation for permissions:
Unix file and directory permission is in the form of a 3×3 structure. i.e Three permissions (read, write and execute) available for three types of users (owner, groups and others).
Three file permissions:
- read: permitted to read the contents of file.
- write: permitted to write to the file.
- execute: permitted to execute the file as a program/script.
- read: permitted to read the contents of directory (view files and sub-directories in that directory ).
- write: permitted to write in to the directory. ( create files and sub-directories in that directory )
- execute: permitted to enter into that directory.
- read 4
- write 2
- execute 1
Change File and Directory Permissions Using Chmod Command
You can use either the octal representation or symbolic representation to change the permission of a file or directory.
Octal representation for permissions:
- First number is for user
- Second number is for group
- Third number is for others
$ chmod 644 filename
For example, give read, execute ( 4 + 1 = 5 ) to user and read (4 ) to group, and nothing ( 0 ) to others.$ chmod 540 filename
For example, give read, write ( 4 + 2 = 6 ) to user and nothing ( 0 ) to group, and read ( 4 ) to others.$ chmod 604 filename
No comments:
Post a Comment