AuthorizedKeysFile .ssh/authorized_keys
Successful public key authentication.
`
debug1: Server accepts key: ... <- never appears
Authentications that can continue: publickey,keyboard-interactive
debug1: No more authentication methods to try.
user@host: Permission denied (publickey,keyboard-interactive).
`
`OpenSSH/Operational` event log only shows:
`
sshd-session: Failed publickey for <user> from <ip> port <port> ssh2: <ED25519|RSA> SHA256:<fingerprint>
//no further detail even with `LogLevel DEBUG3`.
## What we ruled out (with evidence)
We spent a long troubleshooting session confirming, at every layer, that
none of the usual suspects applied:
- **Key integrity**: `ssh-keygen -y -f <private>` on the client matches
the fingerprint in `authorized_keys` exactly. Reproduced with two
completely independent key pairs (ED25519 and a freshly-generated
RSA-4096), both fail identically.
- **`authorized_keys` parsing**: running `ssh-keygen.exe -lf
authorized_keys` **with the installed sshd's own `ssh-keygen.exe`**
returns the correct, matching fingerprint — the binary reads the file
correctly.
- **ACLs**: verified at every level (home dir, `.ssh`, `authorized_keys`
file, and `C:\ProgramData\ssh` itself) — no `Everyone`/`Authenticated
Users` entries anywhere, owner set correctly, matches Microsoft's
documented recommendations for manual installs.
- **Group membership**: account is confirmed NOT a member of
`Administrators` (ruling out the `administrators_authorized_keys`
redirection documented in #2359).
- **`Match`/`ForceCommand` block**: confirmed active for this account via
`sshd.exe -T -C user=<account>,host=...,addr=...,laddr=...,lport=22`.
- **Account status**: `Enabled: True`, `PasswordExpired: False`, no
logon-right restrictions (`SeNetworkLogonRight` includes `Everyone`).
- **Windows-level authentication — the key finding**: Security event log
shows the logon **succeeding** at the Windows level:
Event 4776 (credential validation): Error Code: 0x0
Event 4624 (successful logon): Account Name: <local_account>, Logon Type: 3,
Process Name: C:\Program Files\OpenSSH\sshd.exe
`
This happens via the internal S4U mechanism (`sshd_<pid>` virtual
account, events 4717/4718 granting/revoking `SeBatchLogonRight`
temporarily) — so Windows itself has no problem authorizing the account.
- **sshd version**: reproduced identically on two different releases
(`v9.5.0.0p1-Beta` and `10.0p2`), ruling out a regression specific to
one build.
## The fix that resolved it
Changing `AuthorizedKeysFile` from the default relative path to an
**absolute, quoted path** resolved the issue immediately, with no other
change:
`
AuthorizedKeysFile "C:\Users\<local_account>\.ssh\authorized_keys"
`
After this change and a service restart, the exact same key that was
being rejected authenticates successfully on the first attempt.
## Hypothesis
Since Windows itself confirms successful authentication (event 4624) but
`sshd-session.exe` still rejects the key, the failure appears to happen
**after** the token is generated, when the session process resolves the
user's home directory to build the relative `AuthorizedKeysFile` path.
We suspect the home-directory lookup API used here behaves differently
for local accounts on a domain-joined host than for domain accounts or
local accounts on a workgroup host — but we don't have visibility into
the relevant source to confirm further. Filing this primarily so the
symptom + confirmed workaround are searchable, since we could not find
this specific combination (domain-joined host + local account + default
relative `AuthorizedKeysFile`) documented anywhere, including in the
related-but-different #2359.
OpenSSH_for_Windows_10.0p2 Win32-OpenSSH-GitHub, LibreSSL 4.2.0 (also reproduced on v9.5.0.0p1-Beta)
Prerequisites
Steps to reproduce
dedicated service account with no interactive logon rights, not a
member of
Administrators.v9.5.0.0p1-Betaandthe latest
10.0p2at time of writing — same result on both).AuthorizedKeysFileat its default value insshd_config:C:\Users\<local_account>\.ssh\authorized_keyswith a validpublic key (tested with both ED25519 and RSA-4096 — same result).
.ssh, and theauthorized_keysfile (SYSTEM + Administrators + the account only, noinheritance) — confirmed correct with
icaclsat every level,including
C:\ProgramData\sshitself.Expected behavior
Successful public key authentication.Actual behavior
Error details
Environment data
Version
OpenSSH_for_Windows_10.0p2 Win32-OpenSSH-GitHub, LibreSSL 4.2.0 (also reproduced on v9.5.0.0p1-Beta)
Visuals
No response