Thursday, April 30, 2009

UNIX: File permissions

How to modify file permissions

There are three types of permissions: Read, Write and Execute
And there are three groups you have to consider while changin permissions for a file. user, group (which user belongs to), others (Other users outside of the group)

Use command:
$ chmod 777 file.txt
777 = 7-> user, 7-> group, 7->others
Binary value of 7 is 111 = Read->1, Write->1, Execute->1
So 111 for all three groups.

755 = 7-> user, 5-> group, 5->others
Binary value 7 is 111.
Binary value of 5 is 101 = Read->1, Write->0, Execute->1
So only you have the permission to read, write and execute a file.
Other users can read or execute the file but cannot write.

Still editing this post. Will update soon.

No comments:

Post a Comment