Saturday 27 August 2016

Understanding UNIX permissions and their attributes

Three types of user

 ·        User (owner) – The Owner is the usually the creator of the files/folders. In Linux, files or folders that you created in your Home directory are usually owned by you, unless you specifically change the ownership.

·        Group – The Group contains a group of users who share the same permissions and user privilege.

·        Other – Others means the general public.

Three types of protection

·        Read – You can only view the file, but cannot modify the content of the file. When applied on Folder, you can only view the files in the folder, but you can’t delete from or add files into the folder.
·        Write – You can edit and modify the file. For Folders, you can delete and add files into the folder.
·        Execute – Execute is mainly used when you need to run the file (commonly used when you need to run a script).

Super user can override these protection

Permission
rwx
0
none
---
1
execute only
--x
2
write only
-w-
3
write and execute
-wx
4
read only
r--
5
read and execute
r-x
6
read and write
rw-
7
read, write and execute
rwx

To change permission of file file1 type 
Chmod 777 file1
Well, the first digit is assigned to the Owner, the second digit is assigned to the Group and the third digit is assigned to the Others.
So for a file1 with ‘777’ permission, everyone can read, write and execute the file.

No comments:

Post a Comment