Adding root user to a group | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Adding root user to a group

UNIX for Dummies Questions & Answers


Tags
linux

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-21-2005
The Specialist The Specialist is offline
Registered User
 
Join Date: Oct 2005
Last Activity: 30 May 2009, 10:25 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Adding root user to a group

Hey everyone, I need a little help....

I need to add my root user to a new group I have created, I'm just alittle unsure how to do this.

I know I need to use the 'useradd' command, the user 'root' needs to be added to a new group called 'beoper' and retain his membership in the following groups - 'other, root, bin, sys, adm, uucp, mail, tty, lp, nuucp, daemon'

Could someone please show me the correct syntax to perform this function, I really can't afford to screw this one up. Thanks.
Sponsored Links
    #2  
Old 10-22-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
AFK
 
Join Date: Dec 2004
Last Activity: 10 October 2013, 8:46 AM EDT
Location: UK
Posts: 2,351
Thanks: 0
Thanked 6 Times in 6 Posts
You have things slightly mixed up. useradd is used to add a new user to the system. If you want to edit the attributes of an existing user, you have to use usermod. Run the following command:

Code:
usermod -G beoper root

This will add beoper to the list of groups that root is already a member of. Here is the man page for usermod.
Sponsored Links
    #3  
Old 10-22-2005
The Specialist The Specialist is offline
Registered User
 
Join Date: Oct 2005
Last Activity: 30 May 2009, 10:25 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for that.

Do I need to list all the other groups that root is a member of ?

The -G syntax states that you need to list all current groups or you will no longer be a members of those groups.

I just need to make sure, I can't have any mistakes.

Last edited by The Specialist; 10-22-2005 at 02:14 AM..
    #4  
Old 10-22-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
 
Join Date: Dec 2003
Last Activity: 13 May 2013, 9:02 AM EDT
Location: Melbourne, Australia
Posts: 2,185
Thanks: 3
Thanked 24 Times in 23 Posts
Quote:
Originally Posted by blowtorch
This will add beoper to the list of groups that root is already a member of.
I don't think so... look at the man page....

Quote:
-G group,[...]
A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no intervening whitespace. The groups are subject to the same restrictions as the group given with the -g option. If the user is currently a member of a group which is not listed, the user will be removed from the group
Hence, the user will be, I assume, removed from all groups except their primary group and the beoper group.

I would just go and hack at the /etc/group file, and tack "root" onto the end of the beoper line (comma seperated with the other users listed).

Cheers
ZB
Sponsored Links
    #5  
Old 10-22-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
 
Join Date: Dec 2003
Last Activity: 13 May 2013, 9:02 AM EDT
Location: Melbourne, Australia
Posts: 2,185
Thanks: 3
Thanked 24 Times in 23 Posts
Quote:
Originally Posted by The Specialist
Do I need to list all the other groups that root is a member of ?
If you use usermod, yes. Comma seperated, no spaces. Do not include primary group membership.

Cheers
ZB
Sponsored Links
    #6  
Old 10-22-2005
reborg's Avatar
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,464
Thanks: 0
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by zazzybob
I would just go and hack at the /etc/group file, and tack "root" onto the end of the beoper line (comma seperated with the other users listed).
I'd also do it the way ZB suggests.
Sponsored Links
    #7  
Old 10-22-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
AFK
 
Join Date: Dec 2004
Last Activity: 10 October 2013, 8:46 AM EDT
Location: UK
Posts: 2,351
Thanks: 0
Thanked 6 Times in 6 Posts
Sorry for the wrong info. Actually, I always edit the /etc/group file and it really has been ages since I used the usermod command to add a user to a group.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding a user to a group bigben1220 Shell Programming and Scripting 4 03-05-2010 02:28 AM
Adding User to group saurabh84g Solaris 2 11-22-2008 12:20 PM
Log off mandatory after adding a user to a group to take effect? sirbijan BSD 1 10-09-2008 05:57 AM
Adding user to a group without SAM paqman HP-UX 2 08-15-2007 07:05 AM
Adding a user to a group TRUEST UNIX for Dummies Questions & Answers 5 11-14-2003 10:28 AM



All times are GMT -4. The time now is 04:35 PM.