Let PAM to provision users on their first login

Nico Williams nico at cryptonector.com
Sun Nov 22 04:29:48 AEDT 2026


On Sat, Nov 21, 2026 at 08:12:15AM -0600, Ben Lindstrom wrote:
> However, as for NSS not knowing the UID before PAM starts.  Didn’t
> Google solve this problem by providing a custom NSS module that
> intercepts and send the request to their metadata server and if all is
> good their PAM then module pulls the rest of the information and
> populates the password file?  I believe this is done in their
> compute-image-packages infrastructure.
> 
> Why isn’t this the solution we’re talking about?

It's unnecessarily complex and brittle.  The the getpwnam() happens
before pam_acct_mgmt() then what shall the UID be if it won't be
provisioned until later?  UIDs are a scarce resource.

The right design is that a PAM creates the account if it wants to, and
then only when that is done will getpwnam() resolve.

If you wanted to connect getXbyY() and PAM then I think we need more
explicit contextual information made available to both, meaning: a) new
name service functions, b) PAM extensions.  I sketched out (b) earlier.
(a) isn't extensions but new functions.

Nico
-- 


More information about the openssh-unix-dev mailing list