LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to add a user to a certain group? (http://www.linuxquestions.org/questions/linux-software-2/how-to-add-a-user-to-a-certain-group-134367/)

feetyouwell 01-13-2004 11:39 AM

how to add a user to a certain group?
 
I edit the file /etc/group and put the user i want in the wheel group, save & exit, when i open a terminal as the user and type in "groups", the group information "wheel" didn't show up on the screen.

So then I edit the file /etc/gshadow and edit the line

wheel:*:root:<user_name>,

still when i type "groups", I didn't see wheel there. What did i do wrong?
Also, what's the best way to add a user to a group without using gui.

wapcaplet 01-13-2004 11:44 AM

The method I use is the 'usermod' command. The '-G' option is used to list groups that the user should be in. Any groups that are not listed will be removed, though, so if you want to add 'wheel' to an existing user's groups, run this command:

usermod -G `groups username` wheel username

Those are left-quote marks; they cause the output of running "groups username" to be added to the list.

Sometimes you may have to completely log out and log back in for group settings to take effect; I think this is necessary if you've run X from a console with 'startx', for example.

jtshaw 01-13-2004 11:56 AM

This sounds like an example of Red Hat making something way overly complicated. On all my systems you simply just add the user to the list in the /etc/group file and that is it.


All times are GMT -5. The time now is 08:25 AM.