LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Users & Groups in Linux (https://www.linuxquestions.org/questions/linux-newbie-8/users-and-groups-in-linux-883863/)

gardenair 06-01-2011 12:30 AM

Users & Groups in Linux
 
Hi,
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)

thanks
garden

chrism01 06-01-2011 01:14 AM

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.

HTH

See this doc http://www.linuxtopia.org/online_boo...ion/index.html


All times are GMT -5. The time now is 07:26 AM.