- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- is there a command to remove a user from a group?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 10:58 AM
04-29-2002 10:58 AM
I'm writing custom scripts for our hotline folks to add/remove member(s) from /etc/group - and I have two questions:
(1) When executing "usermod -G $GROUP $ID", *why* does it always automatically add $ID to the "users" group (all of my ID's are in the "users" group via their primary GID found in /etc/passwd - and I don't want them getting added to "users" in /etc/group).
(2) Is there a "reverse" of the command "usermod -G ..." that would REMOVE a user from a group - or am I going to be forced to use 'sed'...
Thanks in advance!
Ben Chapman
bchapman@telcordia.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:05 AM
04-29-2002 11:05 AM
Re: is there a command to remove a user from a group?
-Yates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:14 AM
04-29-2002 11:14 AM
Re: is there a command to remove a user from a group?
I dont seem to suffer from the same problem as you if I am understanding your problem see below.
# cd /etc
#
#
# cat group
root::0:root
other::1:root,hpdb
bin::2:root,bin
sys::3:root,uucp
adm::4:root,adm
daemon::5:root,daemon
mail::6:root
lp::7:root,lp
tty::10:
nuucp::11:nuucp
users::20:root,john
nogroup:*:-2:
oracle::101:
opcgrp::77:
#
# usermod -G 101 john
#
# cat group
root::0:root
other::1:root,hpdb
bin::2:root,bin
sys::3:root,uucp
adm::4:root,adm
daemon::5:root,daemon
mail::6:root
lp::7:root,lp
tty::10:
nuucp::11:nuucp
users::20:root
nogroup:*:-2:
oracle::101:john
opcgrp::77:
#
# uname -a
HP-UX master B.11.00 A 9000/778 2002465323 two-user license
#
As you will see I moved from users to oracle and no duplicate entries !!!!
cheers
John.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:19 AM
04-29-2002 11:19 AM
Re: is there a command to remove a user from a group?
I just tried Davids method and it removed me from my users group
usermod -G "" john
cheers
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:22 AM
04-29-2002 11:22 AM
Re: is there a command to remove a user from a group?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:24 AM
04-29-2002 11:24 AM
Re: is there a command to remove a user from a group?
I'm not sure I follow. Sounds like you want to modify the primary group for a specified user. That would be the "-g" option of usermod.
The "-G" option modifies their secondary group.
Maybe you could include a specific example (with the names, etc changed, of course).
Are your patches up-to-date? What OS release are you on?
I believe "-G" will delete the user from all secondary groups except those specified. I don't know of a command that removes the user from a specific group while leaving him in others.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:35 AM
04-29-2002 11:35 AM
Re: is there a command to remove a user from a group?
-Unfortunately I'm still on HP-UX 10.20 (ulp!) - and this "users" problem is related to that - because I tested on 11.0 and got the same results you all got - IT WORKED as it should. I'll have to deal with this as a separate case...
-Many thanks for the usermod -G "" ID command (using a null group) - that will take the ID out of /etc/group.
Looks like another reason to move off of 10.20. Now if only Oracle 11i would behave, WE COULD GET UPGRADED!
Later,
Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:38 AM
04-29-2002 11:38 AM
Re: is there a command to remove a user from a group?
You must be running 10.x. Prior to 11.0, an entry in /etc/group was made for the primary group of each user. This does not (and need not) occur at 11.x.
Regards!
...JRF...