LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-12-2017, 10:29 AM   #1
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Debian/Ubuntu,CentOS
Posts: 848

Rep: Reputation: 231Reputation: 231Reputation: 231
How to add a user to a group with a command without removing from another group?


I am studying for the RHCSA and I'm on chapter 3 of the Asghar Ghori book. Anyway, one of the exercises has you add a user to a group. Easy enough, right?

Code:
# usermod -G /path/groupfolder user100
But I noticed that when I ran the groups command with user100, the group that he was a part of before, he was no longer a part of, he was only part of the new group I added him to. I know I can just edit /etc/group and add the info in there, but how do I use this command to not replace his original group he's in but add an additional group to user100?

I hope my question is clear. Let me know if you need further clarification.

Also I've read the man page for usermod, and unless I'm not understanding something, it doesn't really explain this.
 
Old 07-12-2017, 10:39 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,983

Rep: Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621Reputation: 7621
did you check the flag -a?
 
1 members found this post helpful.
Old 07-12-2017, 10:49 AM   #3
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Debian/Ubuntu,CentOS
Posts: 848

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
Thanks pan, I had read the man page incorrectly on the -a part. I was reading it as use -G instead of -a. Anyway that works, thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] simple script... take users from a group and add in another group UNIX Zyklon Linux - General 6 03-05-2015 01:55 PM
[SOLVED] Problem while removing file by group user soumyacs Linux - Newbie 3 08-28-2012 06:24 PM
How do I add user and group simultaneously in one command? nav_hind@yahoo.co.in Linux - Newbie 1 11-28-2011 02:35 AM
group: add complete group into other group max_mad SUSE / openSUSE 1 04-12-2006 02:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration