Quote:
I know that in Linux systems every file has got its own rights in a format like this:
rwx rwx rwx
The first block is for the creator, second for the group, and the third for all the others.
|
That's almost correct, except that the first block is for the owner, not the creator. A file may have been created by one user but then ownership subsequently transferred to another user.
To help you understand your next point, take a sample file listing produced by ls -l:
Code:
-rwxr-xr-- 1 hydrurga seals 0 Feb 22 17:59 example
hydrurga, the owner, has "rwx" access to the file "example" (we know it's a file because of the initial '-').
Anyone in the group "seals" has "r-x" access
All the others have only "r" access
You can in fact set access rights for multiple groups using something called "extended attributes", but that is probably beyond the scope of what you're learning at the moment.
So, if you're not the owner, you have to be a member of the "seals" group to have "r-x" access - it doesn't matter what other groups you may belong to.
For the exercise you were given, have a think about how you can change the file in two ways: (i) set its group so that only 'mygroup' members have the relevant access rights; (ii) how to set those access rights, as well as those for the owner and the others.
It doesn't matter whether the group is "secondary" - all that matters is that only one group is to get group access.
I hope that this makes sense.