LinuxQuestions.org
Review your favorite Linux distribution.
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, 09:29 AM   #1
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: mint,deb,centos
Posts: 818

Rep: Reputation: 228Reputation: 228Reputation: 228
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, 09:39 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,621

Rep: Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608Reputation: 5608
did you check the flag -a?
 
1 members found this post helpful.
Old 07-12-2017, 09:49 AM   #3
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: mint,deb,centos
Posts: 818

Original Poster
Rep: Reputation: 228Reputation: 228Reputation: 228
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 12:55 PM
[SOLVED] Problem while removing file by group user soumyacs Linux - Newbie 3 08-28-2012 05:24 PM
How do I add user and group simultaneously in one command? nav_hind@yahoo.co.in Linux - Newbie 1 11-28-2011 01:35 AM
group: add complete group into other group max_mad SUSE / openSUSE 1 04-12-2006 01:43 AM

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

All times are GMT -5. The time now is 06:55 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