Lets' say, user userX is a member of group winners and group losers There is a file with following permissions:

-rw-r-----  userY   winners  1000  May 31 somefile.txt

Can userX access somefile.txt?

  • Homwork? :-) Can you show your research effort (as necessary for this site): Do you think he can, and why? If you don't know, did you try it out? – dirkt Jun 1 '17 at 10:38
  • yes, I tried it on my private computer and I found out that he cannot. – sunny Jun 1 '17 at 14:32
  • The experiment still does not answer to the question, since I don't know why is it so – sunny Jun 1 '17 at 14:33

Linux uses groups as a way to organize users. Groups organize collections of accounts, primarily as a security measure. Control of group membership is administered through the /etc/group file, which shows a list of groups and its members.

Every user has a default or primary group. When a user logs in, the group membership is set for their primary group. This means that when a user launches a program or creates a file, both the file and the running program will be associated with the user’s current group membership.

A user may access other files in other groups, as long as they are also a member of that group and the access permissions are set.

Now if the user wants to creates new files, the permissions will be assigned to the default group, unless specified otherwise. To run programs or create a file in a different group, the user must run the newgrp <newgroup> command to switch their current group.

If the user entering the above-referenced command is a member of the <newgroup> group in the /etc/group file, then the current group membership will change. It is important to note that any files created will now be associated with the <newgroup> group rather than the user’s primary group. Users may also change their group by using the chgrp <group> command.

Source: Linux Users and Groups

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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