GNU bug report logs - #76897
id improvements

Previous Next

Package: coreutils;

Reported by: Nicolas Boos <nicolas.boos <at> wanadoo.fr>

Date: Sun, 9 Mar 2025 17:57:02 UTC

Severity: normal

To reply to this bug, email your comments to 76897 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#76897; Package coreutils. (Sun, 09 Mar 2025 17:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Boos <nicolas.boos <at> wanadoo.fr>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 09 Mar 2025 17:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Boos <nicolas.boos <at> wanadoo.fr>
To: bug-coreutils <at> gnu.org
Subject: id improvements
Date: Sun, 9 Mar 2025 18:53:58 +0100
Context:
$ cat /etc/passwd
nicolas:x:1000:2001::/home/nicolas:/bin/bash
claude:x:1000:2002::/home/claude:/bin/zsh
$ cat /etc/group
gnicolas:x:2001:
gclaude:x:2002:

Test case:
localhost login: claude
$ getent passwd claude 
claude::1000:2002::/home/claude:/bin/zsh
$ id claude
uid=1000(nicolas) gid=2002(gclaude) groups=2001(gnicolas)

groups is wrong, should be "groups=2002(gclaude)".

$ busybox id
uid=1000 gid=2002(gclaude) groups=2002(gclaude)

groups is correct with busybox.

Given the ouput of getent, it could be possible to display a better result:
uid=1000(claude) gid=2002(gclaude) groups=2002(gclaude)

NB





Information forwarded to bug-coreutils <at> gnu.org:
bug#76897; Package coreutils. (Tue, 05 Aug 2025 03:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 76897 <at> debbugs.gnu.org (full text, mbox):

From: Collin Funk <collin.funk1 <at> gmail.com>
To: 76897 <at> debbugs.gnu.org
Subject: Re: bug#76897: id improvements
Date: Mon, 04 Aug 2025 20:21:31 -0700
Nicolas said:

> Context:
> $ cat /etc/passwd
> nicolas:x:1000:2001::/home/nicolas:/bin/bash
> claude:x:1000:2002::/home/claude:/bin/zsh
> $ cat /etc/group
> gnicolas:x:2001:
> gclaude:x:2002:
> 
> Test case:
> localhost login: claude
> $ getent passwd claude 
> claude::1000:2002::/home/claude:/bin/zsh
> $ id claude
> uid=1000(nicolas) gid=2002(gclaude) groups=2001(gnicolas)
> 
> groups is wrong, should be "groups=2002(gclaude)".
> 
> $ busybox id
> uid=1000 gid=2002(gclaude) groups=2002(gclaude)
> 
> groups is correct with busybox.
> 
> Given the ouput of getent, it could be possible to display a better result:
> uid=1000(claude) gid=2002(gclaude) groups=2002(gclaude)

Not really a bug, just a reason to avoid creating multiple users with
the same user-id.

See the following example:

    $ whoami
    root
    $ id claude
    uid=1000(nicolas) gid=2002(gclaude) groups=2001(gnicolas)
    $ busybox id claude
    uid=1000(nicolas) gid=2002(gclaude) groups=2002(gclaude)
    $ su claude
    $ id
    uid=1000(nicolas) gid=2002(gclaude) groups=2002(gclaude)
    $ busybox id
    uid=1000(nicolas) gid=2002(gclaude) groups=2002(gclaude)

One would expect that after logging into claude, id would print that
user name. But since nicolas shows up first in /etc/passwd that is what
we see.

Coreutils will then use the group id from the 'struct passwd' for
nicolas which is 2001(gnicolas) in this case. I think that busybox uses
the name passed to the command-line to call 'getgrouplist' which will
then return gclaude.

Collin




This bug report was last modified 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.