LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Trying to Add Users to Newly Created Group (Red Hat version) (https://www.linuxquestions.org/questions/red-hat-31/trying-to-add-users-to-newly-created-group-red-hat-version-573821/)

Linux_Enabled 07-31-2007 09:45 PM

Trying to Add Users to Newly Created Group (Red Hat version)
 
I have just created a new group and would like to add existing users to the new group. I've already changed the ownership of the files to myself in the newly created group. I want to do this because the information in the files is very sensitive and I want to limit access to the files to members of the new group only. It seems to me, intuitively, that one may either be able to change ownership of the files to a group but not a particular user, or add users to the restricted group and they will automatically have access to the files. I will greatly appreciate any assistance any one can provide.

loonix 07-31-2007 10:13 PM

Hi there is several ways to do this but this is one way:
Check what groups the user is already in.
as root:
root#: groups username
tty wheel audio users

This will tell you the groups that username belongs to.
In this case tty wheel audio and users.
To add this user to the group "secret"
do the following as root:
root#: usermod -G tty,wheel,audio,users,secret username

This would add username to the secret group and leave them in the groups they were already in.
Then remember to set the permissions properly for the file(s) you want to give group access to.

root#: chgrp secret filename
root#: chmod 660 filename


Hope this helps.


All times are GMT -5. The time now is 06:03 AM.