NetBSD Problem Report #56138
From www@netbsd.org Sat May 1 06:42:30 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id A60A01AC716
for <gnats-bugs@gnats.NetBSD.org>; Sat, 1 May 2021 06:42:30 +0000 (UTC)
Message-Id: <20210501064229.4CE421AC715@mollari.NetBSD.org>
Date: Sat, 1 May 2021 06:42:29 +0000 (UTC)
From: parrottjustin16@gmail.com
Reply-To: parrottjustin16@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Changing Login field with chsh requires manual effort
X-Send-Pr-Version: www-1.0
>Number: 56138
>Category: bin
>Synopsis: Changing Login field with chsh requires manual effort
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 01 06:45:00 +0000 2021
>Last-Modified: Fri Jun 04 18:50:00 +0000 2021
>Originator: Justin Parrott
>Release: 9.1
>Organization:
independent
>Environment:
NetBSD cityboy 9.1 NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
Changing the Login name with chsh creates a new entry in the password database but doesn't delete the old one. I went ahead and deleted the record from master.passwd and remade the password database.
>How-To-Repeat:
chsh; #and edit the Login: field
>Fix:
on second thought this might be known and not a bug, but here goes anyway...
>Audit-Trail:
From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/56138: Changing Login field with chsh requires manual
effort
Date: Sat, 1 May 2021 09:57:32 -0500 (CDT)
It uses pw_copy(3) and its behavior is documented: "... updating the
entry corresponding to pw->pw_name with the information ... If an entry
is not found to match pw, a new entry is appended to the passwd file
..."
From looking at the 1991 CSRG pw_cop.c code I see it does the same
thing.
We can add a reference to pw_copy(3) and maybe a summary of statement
above it the chpass.1 manual.
By the way, another way is to do:
usermod -l newloginid oldloginid
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/56138: Changing Login field with chsh requires manual effort
Date: Fri, 4 Jun 2021 18:47:32 +0000
On Sat, May 01, 2021 at 06:45:00AM +0000, parrottjustin16@gmail.com wrote:
> Changing the Login name with chsh creates a new entry in the
> password database but doesn't delete the old one. I went ahead and
> deleted the record from master.passwd and remade the password
> database.
I would not have expected it to allow you to try to do that; it's for
editing one user's info and mucking with the login name (or uid)
potentially changes which user it's describing.
Use vipw(8) (or usermod etc.) for such changes.
Probably chsh/chfn/chpass (it's all one thing) should not allow trying
to change the username or uid.
--
David A. Holland
dholland@netbsd.org
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.