Adding user to a secondary group ?
If user1's main group is genetics and one wants to add him/her to group biochem and to assign biochem as his/her secondary group will the following suffice ?
Would having user1 main group genetics, secondary group biochem fulfil this criteria ?
You are right,
You can also use gpasswd command
root#gpasswd -a user1 biochem
At the mean time , if user belong to more than one group the group owner of files/directory created by user will be primary group. although you can change this temporarly by using newgrp command
now whatever files/directory created group owner will be biochem
I needed to clarify if the user's primary group would also be the group owner of any files/directories created so users from another group would not have access to the files unless permissions were explicitly set to allow them to do so.
Note that if you want to ensure security in personal dirs, but share files in groups, you can create a new dir owned by eg the 'group' user (eg chown grp1:grp1 gpr1share ) and set
on the group dir. This forces all files created in the new dir to have the same group ownership automatically, regardless of who creates them.
Obviously all members need to have that group in their group list.
You are right. To set permission to specific group other than group owner you should use acl option.
So chris you are basically saying create a third group called for example "science" and make this the secondary group for both genetics and biochem. In this way any private files with group ownership biochem would be protected from the prying eyes of genetics. If I follow your example will I also have to create a new user called "science" making sure the account has no login shell ?
Share directory is lifescience
$ chown science:science lifescience
$ chmod g+s lifescience
So everything created in the directory lifescience with have file owner as science and group owner as science. Both genetics groups and biochem groups will have science as their secondary group so biochem's private files will be safe from genetics as biochem is no longer genetics' secondary group ?
|All times are GMT -5. The time now is 01:15 PM.|