Skip to content
Advertisement

Understanding Unix Owner and chmod 777

I understand, Unix has 3 levels of ownership: Owner, Group, and Others. The owner is the one who creates the file and later on this Ownership can be moved using ‘chown’. However, I am confused with chmod 777 to ‘others’ or ‘groups’.

Executing the previous command on a file will also allow the users in the group/other to have the same privileges as the owner. Thus,

  1. Is my understanding correct: A file can have multiple owners?
  2. What is the use of chown if chmod 777 can help achieve the same task?
  3. Can a user in ‘chmod 777 group’ restrict the access of the actual owner by the command chmod u=r filename?

Advertisement

Answer

You must not confuse: access rights and ownership.

If someone owns an object it has rights to do whatever he wants with it, including modifying access rights and ownership. Be aware that once someone resign for ownership he cannot get it back on his own. So, if you own a house you can manage it the way you want and let people enter or not.

Access rights define who can do what on a file, independently from ownership. I suppose it is frequent for you to enter a building without asking for ownership, this is the same.

Access rights just define if someone (or a group or a set of users) has the right to read the content, modify the content or execute the content (at least basically). But properties like ownership, access rights are not parts of content of the file, they are meta-data associated to, and modifying theses meta-data is possible in very special ways. Ownership and access rights for instance can only be modified by owner.

Now:

A file can have multiple owners?

Yes it is possible but not with the basic access rights and ownership as describes. In basic Unix, there can be only a single owner.

What is the use of chown if chmod 777 can help achieve the same task?

chown is ownership transfer (you sell your house). chmod is just a way to modify policy for people entering the house.

Can a user in ‘chmod 777 group’ restrict the access of the actual owner by the command chmod u=r filename?

Don’t know what ‘chmod 777 group’ is. But nobody except owner (and root but root is a very special user) can change any such metadata (ownership, access right).

Advertisement