The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > HP-UX
Google UNIX.COM


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding quota for a group manoranjan UNIX for Advanced & Expert Users 1 12-21-2006 01:35 PM
Adding users to /etc/group golfhakker UNIX for Dummies Questions & Answers 1 03-30-2006 01:27 PM
Adding root user to a group The Specialist UNIX for Dummies Questions & Answers 7 10-28-2005 07:09 PM
Adding an extension to a group of filenames pepintheshort UNIX for Dummies Questions & Answers 9 04-09-2004 05:11 PM
Adding a user to a group TRUEST UNIX for Dummies Questions & Answers 5 11-14-2003 08:28 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-14-2007
Registered User
 

Join Date: Jul 2007
Posts: 21
Adding user to a group without SAM

How can I add a user to a specific group without using SAM? I know I can user modprpw -G, but that will overwrite any groups the user is in with the ones I specify.

I need to assume that I do not know what groups the user is already in, so I can't put them in the modprpw command. I just need to add this user to a few groups without changing the ones they are already in.

FYI, i'm talking about secondary groups, not their primary group. And I'm scripting this, so I can't just go into /etc/group and edit it manually.

Thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 08-14-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
If you have modprpw your box must be in trusted mode so you need to use modprpw. You can obtain the list of groups a user in currently in via groups or grget commands. Then check to see if you need to add the user at all. He might already be in the group in question. If not, construct a new list of groups by adding yours to any pre-existing groups.
Reply With Quote
  #3  
Old 08-15-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,328
To get a list of groups that the user belongs to, you can use "id -a". Parse the output of that command to get the list of groups that the user belongs to. Then give the entire list to modprpw or whatever you are using.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0