#1021745 passwd: /etc/passwd was edited with the wrong shell path

Package:
passwd
Source:
passwd
Description:
change and administer password and group data
Submitter:
Najib B
Date:
2024-06-22 14:12:03 UTC
Severity:
normal
Tags:
#1021745#5
Date:
2022-10-13 22:18:26 UTC
From:
To:
Dear Maintainer,

I have just noticed this issue on chsh that I would like to report to you,
including a solution that I would like to mention.

exit
$ sudo chsh
Password:
chsh: PAM: Authentication failure`
-----------------------
The problem here, is that chsh has accepted "zsh" without checking first, if
that path exists.

After exiting "root" it is not possible to login back.
The solution is to edit /etc/passwd from this:
root:x:0:0:root:/root:zsh
to this:
root:x:0:0:root:/root:/bin/zsh

Best regards,

#1021745#10
Date:
2022-10-14 13:11:17 UTC
From:
To:
Well no, it clearly checked, and warned you.  You chose to
ignore the warning.  If we refuse to set it, we'll get tons
of bug reports about that.  We could add a fail-on-warning
option I suppose...  But if you choose to ignore the warnings
I don't think you'd use that option.

#1021745#15
Date:
2022-10-14 16:33:46 UTC
From:
To:
---------- Forwarded message ---------
De: Serge E. Hallyn <serge@hallyn.com>
Date: vie, 14 oct 2022 a las 17:56
Subject: Re: [Pkg-shadow-devel] Bug#1021745: passwd: /etc/passwd was edited
with the wrong shell path
To: Najib Bakari <najibbakari@gmail.com>
Cc: Serge E. Hallyn <serge@hallyn.com>

Right, you'd have to reset it after seeing the warning.

This isn't something that has recently changed, it's been like this
for 25 years.

I'm open to a patch that will accept a new /etc/login.defs variable to
affect this - it could, if set, simply refuse on unknown shell, or
ask "are sure".  However, github.com/shadow-maint/shadow woudl be the
place for this.  The debian package would simply make a change to
the debian/login.defs (if it wants) to set the default.  Feel free to
create an issue or, better, submit a PR there :)

thanks,
-serge