Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-01-2011, 01:30 AM   #1
Registered: Oct 2004
Location: LH
Posts: 610

Rep: Reputation: 31
Users & Groups in Linux

I am using Fedora in my pc. I want to clear about the status of users after adding him into a new group.
Suppose I have two users i.e user1 and user2 and I make a group i.e sales.Taking id command show me that user1 is member of group user1 after that it show groups=501 which is not clear and member of sales group (508)?

One thing I know that whenver a user is created he is also a member of that group i.e user1 and group user1 ami correct ?

Following is the complete steps and I hope it will be easy for you to guide me about the affects by taking id command.

[root@localhost ~]#useradd user1
[root@localhost ~]#useradd user2
[root@localhost ~]#groupadd sales
[root@localhost ~]#usermod -G sales user1
[root@localhost ~]#usermod -G sales user2
Now Check it
[root@localhost ~]#id user1
Uid=501(user1) gid=501 (user1) groups=501 (user1), sales (508)
[root@localhost ~]#id user2
Uid=502(user2) gid=507 (user2) groups=507 (user2), sales (508)


Last edited by gardenair; 06-01-2011 at 01:51 AM.
Old 06-01-2011, 02:14 AM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
I'm not quite clear what your problem is, but anyway....

When you create a user, he is assigned a username (login name) and a numeric uid. He is also assigned a PRIMARY numeric gid (which will also have a group name).
The username, uid, gid (primary) are to be found in /etc/passwd.
You may also add the user into 1 or more SECONADRY groups; these are specified in the /etc/group file.
Note the RHEL and derived systems default to setting the default (primary) gid to the same value as the uid, in order that each user is in his own group by default, thus preventing security leaks via group ownerships.
Contrast with trad *nix ( and other Linux distros) that have the same default group for all 'normal' users.


See this doc
1 members found this post helpful.


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
Tidewater Unix (& Linux) Users Group, Virginia dfowensby Linux User Groups (LUG) 4 01-30-2010 11:54 PM
How to handle with users & password with a server and plently linux boxes? Xeratul Linux - General 2 01-05-2007 04:02 PM
nvidia & linux users please take a look gfhr- Linux - Hardware 11 07-18-2004 10:49 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:16 PM.

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