just issue
usermod -g newgrpname username
forexample: if user1 is in demo grp and i want to change his grp to user1
usermod -g user1 user1
Main Topics
Browse All TopicsHow can I remove user from a group in redhat enterprise v4?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
If you want to use the command line, you will have to list all the groups that you want the user in. For esample if the user currently in group1,group2,group3,group
usermod -G group1,group2,group4 loginName
Using the GUI in this case is much simpler
http://www.redhat.com/docs
This might seem a little convoluted, but it'll do it in one line:
usermod -G `id -Gn <username>|sed 's/<group to remove> //'|tr -t " " ","`
breaking down what's in between the back-ticks (before id and at the end):
id -Gn (username) - returns the names of the groups that (username) belongs to.
sed 's/<group to remove> //' - removes the group you want eliminated from the id list
Note: those are single quotes before the s and after the last slash(/)
tr -t " " "," - translates the spaces in the list to commas so that the list will work with usermod
While this does work in one command (as you requested :-), it may be easier to create a little shell script and pass it the username and group as parameters.
Hope this helps.
hey, infotactix gave you a great way to do this automated :-D
I would go ahead and put this in a shell script as infotactix proposed:
usambadel.sh:
====================
#!/bin/sh
usermod -G `id -Gn $1 | sed 's/samba//'|tr -t " " ","`
====================
save
chmod +x usambadel.sh
and the issue
usambadel.sh username
very easy, when someone like infotactix goes ahead and create a solution and even test it for you ;-)
Business Accounts
Answer for Membership
by: amit_gPosted on 2007-06-27 at 13:40:10ID: 19376047
http://www.redhat.com/docs /manuals/e nterprise/ RHEL-5-man ual/ Deploy ment_Guide -en-US/ch- users-grou ps.html