![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
||||
|
||||
|
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.
|
||||
| Google The UNIX and Linux Forums |