Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
---x--x--- 1 root stapusr    87992 Oct 20 23:44 staprun

What I showed above is the owner of file staprun. But user root doesn't belong to groupstapusr. What does it mean?

I assumed that before chown userxxx:groupxxx filename has been executed, the userxxx should belong to groupxxx .

share|improve this question

migrated from stackoverflow.com Oct 24 '13 at 6:06

This question came from our site for professional and enthusiast programmers.

1  
Root is unfettered by such trivial details as 'does the user belong to the group'. At the o/s level, there is no such enforcement. –  Jonathan Leffler Oct 24 '13 at 1:30

1 Answer 1

Of the user and group that owns a file, the user is not necessarily a member of the group.

share|improve this answer
    
Of course, only root (I'm pretty sure) can chown a file's group to something the user's not in. –  Kevin Oct 24 '13 at 1:19
1  
That's normally, but not necessarily, the case. It might be that the directory sets the group permission (SGID bit), while the user has write permission to the directory (perhaps public write permission, perish the thought, unless the directory has the sticky bit set; or perhaps because of ACLs). But in the normal case, a file is created belonging to the effective GID of the process that creates the file. –  Jonathan Leffler Oct 24 '13 at 1:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.