Let PAM to provision users on their first login
Marco Trevisan
marco at ubuntu.com
Fri Nov 20 09:10:20 AEDT 2026
On 19 nov 2026 at 15:43, Nico Williams wrote:
> Certainly the login could not complete if getpwnam() does not resolve
> the user to a UID (and other things) before the end of the login
> process
> -- Unix/POSIX requires a UID and GID for the user's processes, a
> shell,
> a home directory. Unix/POSIX does not require that PAM be or not be
> given a chance to create the account first. PAM is not traditionally
> a
> part of Unix, but then again it's been a part of life on Unix-ish
> operating systems for almost 3 decades, and that's almost long enough
> to
> consider it part of the Unix tradition.
Yeah, sadly it's what we have and it's far from being a great system.
But in Linux/glibc at least that's what can authenticate and create
users for us.
And indeed getpwnam() is still relevant the whole point of this serie
is to do it ALSO after a PAM transition is over, before deciding
whether an use really exists.
> I don't see why the getpwnam() call couldn't be delayed so as to give
> PAM a chance to create the user account, but I do think it's a
> reasonable policy position to have that that shouldn't be possible, at
> least with PAM as it is, though it's not a position I take.
Yeah, I mean I added an option to control that as it looked to me
something
whose policy could have been controlled per setup.
> But PAM a) SUX, b) does need more ways to tell the modules how the
> user
> was authenticated when the 'how' is "not with pam_authenticate()"
> (i.e.,
> not keyboard-interactive, not password) so that PAM could make better
> authorization decisions.
We can all agree on a), but again it's the only standard we have so far.
We do want to work on something better that systemd can provide, but
again
that will be even less supported and definitely very linux/systemd
bound.
I'm unsure I got your b) point fully.
More information about the openssh-unix-dev
mailing list