Let PAM to provision users on their first login
Demi Marie Obenour
demiobenour at gmail.com
Fri Nov 20 14:33:40 AEDT 2026
On 11/19/26 4:14 PM, Klaus Ethgen wrote:
> Am Do den 19. Nov 2026 um 0:43 schrieb Marco Trevisan:
>> On each user login attempt, sshd looks the user up via NSS before
>> authentication, and if the user does not exist it marks the login
>> as invalid: the real password is replaced by a fake one, PAM success
>> is treated as an internal error, and the login can never succeed.
>
> And that is good that way.
>
>> This prevents PAM modules that create the account as part of the
>> authentication from working over SSH.
>>
>> In Ubuntu we have authd [1], which authenticates users against an
>> identity provider (Entra ID, Google, ...) and creates the local
>> account on first login; other services (directory or cloud identity
>> integrations, on-demand provisioning on servers), relying on samba
>> or SSSD have the same need.
>
> Why don't you just provide nss with the same backend that you do with
> pam? Same way as sssd and samba does.
>
> Either the user exists (and nss and pam both know about that) or it does
> not.
>
> Not that I would like the mentioned providers but this is your problem.
>
> Changing ssh to just fulfil a strange corner case is a very bad idea!
>
> Gruß
> Klaus
From the perspective of the authentication system, the user either
exists or does not. However, I suspect NSS doesn't have the needed
credentials to query if a user exists. PAM, on the other hand, can
include the user's credentials as part of its request, and can store
the server's information for later use.
Giving NSS the ability to query if any user exists would be a security
risk (in case the server was compromised) and gain nothing other than
making OpenSSH work.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20261119/9f4745f5/attachment-0001.asc>
More information about the openssh-unix-dev
mailing list