Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jul 2023 13:57:17 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 238995] adduser does not check for pre-existing user field entries in /etc/group
Message-ID:  <bug-238995-227-jmiBhmB3Kp@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-238995-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-238995-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238995

--- Comment #7 from Naman Sood <naman@freebsdfoundation.org> ---
Hello! I just finished looking into this, and a few things to note:

1. Your 2023 example is expected behavior - `pw groupshow` will list the gr=
oups
as in /etc/group, but group(5) notes that "A user is automatically in a gro=
up
if that group specified in their /etc/passwd entry and does not need to be
added that group in the group file." Since in that example, the user riscv's
login group was riscv, pw did not add it to the group file. If you'd like to
get group membership that keeps such things in mind, `id riscv` shows that.

root@neon-testvm:~ # pw groupadd -n testuser -g 4242
root@neon-testvm:~ # adduser
Username: testuser
Full name:=20
Uid (Leave empty for default): 4242
Login group [testuser]:=20
Login group is testuser. Invite testuser into other groups? []:=20
Login class [default]:=20
Shell (sh csh tcsh nologin) [sh]:=20
Home directory [/home/testuser]:=20
Home directory permissions (Leave empty for default):=20
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]:=20
Username   : testuser
Password   : <disabled>
Full Name  :=20
Uid        : 4242
Class      :=20
Groups     : testuser=20
Home       : /home/testuser
Home Mode  :=20
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (testuser) to the user database.
Add another user? (yes/no): no
Goodbye!
root@neon-testvm:~ # cat /etc/group | grep testuser
testuser:*:4242:
root@neon-testvm:~ # pw groupshow testuser
testuser:*:4242:
root@neon-testvm:~ # id testuser
uid=3D4242(testuser) gid=3D4242(testuser) groups=3D4242(testuser)

The bugs exposed by your 2021 and 2019 examples have been fixed in the comm=
its
above.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238995-227-jmiBhmB3Kp>