Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

id and groups do not show the same things when a userid is put

SOLVED
Go to solution
Catherine Forget
Frequent Advisor

id and groups do not show the same things when a userid is put

Hi,
Could someone explain to me why the command "id" and "id toto" does not return the same thing when I am logged with the userid 'toto'?
I have the same problem with the command groups.
I am using a local /etc/group and it does contain less than 2048 characters per groups.

i.e.:
wcalqk0z[7]: id
uid=29435(toto) gid=4000(mfgext) groups=34000(A000ext28),34011(A011ext2),34003(A003ext27),34005(A005ext24),34004(A004ext24),4300(tldnext),4140(mtrain),4008(mswd),4006(msmext2ext3),4003(mpl2ext),44441(minnet),4001(mdevext),4144(bpd4144)
wcalqk0z[8]: id bp29435
uid=29435(bp29435) gid=4000(mfgext)

Any idea what can be done so the results is the same?
Thanks in advanced,

Cat.
14 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: id and groups do not show the same things when a userid is put

Hi Cat:

It would appear that you have TWO accounts with the same uid.

Regards!

...JRF...
Catherine Forget
Frequent Advisor

Re: id and groups do not show the same things when a userid is put

Nop! I have only one :
wcalqk0z[374]#cat /etc/passwd | grep 29435
toto:NvcZPcXfZgJB6:29435:4000:toto:/home/chloe/toto:/bin/csh
wcalqk0z[376]#
Dennis Handly
Acclaimed Contributor

Re: id and groups do not show the same things when a userid is put

>what can be done so the results is the same?

You have to be root to get the supplementary groups.

>JRF: It would appear that you have TWO accounts with the same uid.

Sure looks like it.

>I have only one:

What does this show:
grep bp29435 /etc/passwd

Why did you use id(1) on that user? Did you recently delete it?
Catherine Forget
Frequent Advisor

Re: id and groups do not show the same things when a userid is put

Hi Dennis,

There is still only one id:
wcalqk0z[390]#grep bp29435 /etc/passwd
bp29435:M22.sfjIpoMEE:29435:4000:toto:/home/chloe/bp29435:/bin/csh
wcalqk0z[391]#

One of my customer runs both command on the userid trying to log to an application.

Actually, the commands works fine in the prod environment when the /etc/group file contains all the groups (no ldap lookup). I am not root to run it.
In the Lab environment, using nis, I added all the groups in /etc/group instead of a '+' as usual but it does not returns the same results than in prod.
Robert-Jan Goossens_1
Honored Contributor

Re: id and groups do not show the same things when a userid is put

Hi Catherine,

# grep 29435 /etc/passwd

It looks like both accounts have the same uid.

toto:NvcZPcXfZgJB6:29435:4000:toto:/home/chloe/toto:/bin/csh
bp29435:M22.sfjIpoMEE:29435:4000:toto:/home/chloe/bp29435:/bin/csh


Regards,
Robert-Jan
Catherine Forget
Frequent Advisor

Re: id and groups do not show the same things when a userid is put

Hi, There is only one account.
I changed bp29435 to toto at the beginning because I did not want to put the real id, but Dennis asked for grep bp29435 (which is the real id of the user).
Hakki Aydin Ucar
Honored Contributor

Re: id and groups do not show the same things when a userid is put

try this one, and post output :

grep -E 'toto|bp29435'
Hakki Aydin Ucar
Honored Contributor

Re: id and groups do not show the same things when a userid is put

sorry i previous was typo: issue this command:

# grep -E 'toto|bp29435 /etc/passwd
Catherine Forget
Frequent Advisor

Re: id and groups do not show the same things when a userid is put

wcalqk0z[392]#grep -E 'toto|bp29435' /etc/passwd
bp29435:M22.sfjIpoMEE:29435:4000:Dagenais Yves:/home/chloe/bp29435:/bin/csh
wcalqk0z[393]#
Hakki Aydin Ucar
Honored Contributor

Re: id and groups do not show the same things when a userid is put

ok, apparently you do not have user toto in passwd file. so if you issue:

# id

you still can see user "toto" ?

and also issue the command ;

# logins | grep -i toto

And besides , you say you changed toto to bp29435 . Which method did you use , did you do it inside /etc/passwd ?
Catherine Forget
Frequent Advisor

Re: id and groups do not show the same things when a userid is put

Sorry all for the confusion. There was never a user called toto. I modify the returns of the commandes id and groups so I do not have to give the real id of the user.
The id always been bp29435.
toto never existed.
TTr
Honored Contributor
Solution

Re: id and groups do not show the same things when a userid is put

I checked and noticed that the /etc/logingroup file controls the output of the id command.

If /etc/logingroup exists (as a hard link to /etc/group) you will get the same long output (membership of all groups) if you type "id" and "id toto".

If the /etc/logingroup does NOT exist, "id" gives you the long output and "id toto" gives you the short output (primary group only).

My HP-UX is 11.11.
Dennis Handly
Acclaimed Contributor

Re: id and groups do not show the same things when a userid is put

>There is still only one id:

You listed two, so we were confused.

> I modify the returns of the commands id and groups

That's fine, you just need to do that consistently. :-)

As I said above, you don't get the supplementary groups if you give an user, id(1) says:
If the process has supplementary ...

This says "process", not for user.

>TTr: I checked and noticed that the /etc/logingroup file controls the output of the id command.

That used to be the case, my 11.11 system doesn't need that link.
Catherine Forget
Frequent Advisor

Re: id and groups do not show the same things when a userid is put

Thanks very much all. After creating /etc/logingroup, I got the good (or expected) output.