File permission

Hi,

Could you please tell me the OS command to grant as similar to below permission?

rwxrwxr-x

OS -- HP-UX

Regards,
Maddy

chmod 775 filename

Each group of three is rwx, where x=1, w=2, r=4. 4+2+1=7, so rwx is 7. rx=1+4=5.

Hi Corona,

Thanks.

chmod 775 filename -- Do this permission have all read,write and execute? if so what is the difference between chmod 777 filename and chmod 775 filename? Could you please clarify?

Regards,
Maddy

The difference is 2. And 2 means w.

Each digit is a sum of r, w, and x, where r=4, w=2, x=1. So --x=1, -w-=2, -wx=3, r--=4, r-x=5, rw-=6, rwx=7.

r w x   r w x   r - x 

4+2+1=7 4+2+1=7 4+0+1=5

Hi Corona,

I don't understand. Could you please tell me the difference between chmod 777 filename and chmod 775 filename?

Regards,
Maddy

Here again is the complete meaning of all those digits:

7 = rwx
6 = rw-
5 = r-x
4 = r--
3 = -wx
2 = -w-
1 = --x
0 = ---

Since 7 means rwx, and 5 means r-x, you can pile them together like 775 to get rwxrwxr-x.

Hi Corona,

Thanks. I understood for chmod 775.

I want to know the difference for chmod 777 filename ?

Regards,
Maddy

In a three digit permission, the 1st digit indicates permissions granted the file's owner, the 2nd digit indicates permissions granted to the users in the file's group, and the 3rd digit indicates permissions granted to everyone else. When a digit is 7, that class of users has read, write and execute (for regular files) or search (for directories) permission. When a digit is 5 that class of users does not have write permission.

The difference between 777 and 775 is that users who are not the file's owner and who are not in the group of that file do not have permission to write to the file if the mode is 775, but do have permission to write to that file if the mode is 777. (If the file is a directory, write permission is needed to create a file in that directory and to remove a file from that directory.)

1 Like

Thanks Cragun. Well explained.