0

I'm on Ubuntu.

$ whoami
eugen
$ id
uid=1000(eugen) gid=1000(eugen) groups=1000(eugen),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),134(lxd),135(sambashare)
$ id eugen
uid=1000(eugen) gid=1000(eugen) groups=1000(eugen),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),134(lxd),135(sambashare),137(docker)

Why is that?

Eugen
  • 101

2 Answers2

3

I’m guessing you’ve just added yourself to the docker group, and haven’t logged back in yet — so id shows your old groups (those which the current user has), id eugen loads the current groups for eugen and includes docker.

See I added a user to a group, but group permissions on files still have no effect for details.

Stephen Kitt
  • 434,908
3

id alone reports the attribute of the process (its euid, egid, and the supplementary gids), and translates those to corresponding user/group names by querying the passwd/group databases.

Those ids will have been set in an ancestor process that was running login or equivalent and called init_group() to retrieve the uid and groups for the user that logged in.

The euid or egid can change if a setuid / setgid application has been executed.

id eugen queries the passwd/group databases. So you see the user and group ids and names that the user would get if they logged in now.

Beside the setuid/segid application, that can differ if the accounts database has been modified since you logged in.