Bug 238995 - adduser does not check for pre-existing user field entries in /etc/group
Summary: adduser does not check for pre-existing user field entries in /etc/group
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-04 19:29 UTC by Dennis Clarke
Modified: 2019-07-04 19:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Clarke 2019-07-04 19:29:22 UTC
Seems minor but merely annoying. One may edit /etc/group before running
adduser and put in the future username for some group.  Seems trivial.
 
vesta# uname -a 
FreeBSD vesta 12.0-RELEASE-p4 FreeBSD 12.0-RELEASE-p4 GENERIC  amd64

Toss a group into /etc/group :

vesta# /usr/bin/printf "foo:*:12345:someuser\n" >> /etc/group
vesta# grep 'foo' /etc/group
foo:*:12345:someuser
vesta# 

Now run adduser and toss a new user into the system with that group
as a part of the creation process : 

vesta# adduser
Username: someuser
Full name: Some Test User
Uid (Leave empty for default): 54321
Login group [someuser]: 
Login group is someuser. Invite someuser into other groups? []: foo
Login class [default]: 
Shell (sh csh tcsh bash rbash git-shell nologin) [sh]: 
Home directory [/home/someuser]: 
Home directory permissions (Leave empty for default): 
Use password-based authentication? [yes]: 
Use an empty password? (yes/no) [no]: 
Use a random password? (yes/no) [no]: 
Enter password: 
Enter password again: 
Lock out the account after creation? [no]: 
Username   : someuser
Password   : *****
Full Name  : Some Test User
Uid        : 54321
Class      : 
Groups     : someuser foo
Home       : /home/someuser
Home Mode  : 
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (someuser) to the user database.
Add another user? (yes/no): no
Goodbye!
vesta# 

Here adduser duplicates the entry for the group 'foo' : 

vesta# grep 'foo' /etc/group
foo:*:12345:someuser,someuser
vesta# 
 
Seems trivial and slightly annoying.

-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional