Troubleshooting
Quick Diagnostics
Before diving in, run k9-ssh manually as the key9 user. This bypasses sshd entirely and shows exactly what k9-ssh returns:
sudo -u key9 /opt/k9/bin/k9-ssh --user=<username>Then check syslog for any messages from k9-ssh:
# Debian / Ubuntu
grep k9-ssh /var/log/auth.log
# RHEL / Fedora / AlmaLinux
grep k9-ssh /var/log/secure
# systemd (most Linux)
journalctl -t k9-ssh
# FreeBSD / OpenBSD
grep k9-ssh /var/log/authlogCommon Problems
No keys returned, no syslog errors
Symptom: k9-ssh exits with code 0 and no output. sshd falls back to other auth methods (password prompt, or Permission denied).
Causes and checks:
User not in machine group — The Key9 user does not have access to the machine group configured in
k9.yaml. Log in to the Key9 dashboard and verify the user's group assignments matchmachine_groupin your config.User has no SSH keys in Key9 — The user exists in Key9 but has not uploaded an SSH public key. Have them add a key via the Key9 dashboard.
Wrong machine group name — Typo in
k9.yaml. Group names are case-sensitive. Checkmachine_groupagainst the exact name shown in the Key9 dashboard.
user mismatch in syslog
Symptom:
Cause: k9-ssh was called by a user other than the one specified in run_as. This almost always means AuthorizedKeysCommandUser in sshd_config does not match run_as in k9.yaml.
Fix: Ensure both values are identical (typically key9):
invalid username in syslog
Symptom:
Cause: The username passed via --user does not match the allowed pattern ^[a-z_][a-z0-9_\-]{0,31}$. This means:
The username contains uppercase letters
The username contains characters other than
a-z,0-9,_, or-The username is longer than 32 characters
The username starts with a digit
Fix: Ensure the Key9 username matches a valid Unix username. Rename the account in Key9 if necessary.
API connection error in syslog
Symptom:
Causes and checks:
No outbound HTTPS access — The host cannot reach
ssh-api.k9.io:443. Test with:If this fails, check your firewall or proxy settings.
DNS resolution failure — The host cannot resolve
ssh-api.k9.io. Test with:Timeout too short — The default
connection_timeoutis 5 seconds. If your network has high latency, increase it:Proxy required — If outbound traffic must go through an HTTP proxy, set the standard Go proxy environment variables for the
key9user:
Non-200 status in syslog
Symptom:
Cause by status code:
401
Invalid or missing API key / company UUID
403
API key does not have permission for this operation
404
Endpoint URL is wrong
429
Rate limited
5xx
Key9 API server error
Fix for 401/403: Verify api_key and company_uuid in k9.yaml exactly match the values shown in the Key9 dashboard. Credentials are combined as company_uuid:api_key in the request header.
config file not found or error loading config
Symptom:
Fix:
SSH login still requires password after configuration
Symptom: After configuring AuthorizedKeysCommand, SSH logins still prompt for a password.
Checks:
sshd was not restarted — Changes to
sshd_configrequire a reload:sshd_config syntax error — A syntax error prevents sshd from loading the new configuration. Check:
Fix any errors reported before restarting.
PubkeyAuthenticationis disabled — Ensure it is enabled:k9-ssh not executable — Verify:
sshd cannot execute the command — Some SELinux / AppArmor policies prevent sshd from running external binaries. Check
audit.logordmesgfor denial messages.
Keys returned but login still fails
Symptom: k9-ssh outputs valid-looking keys, but SSH login still fails.
Checks:
Client is not using the matching private key — The public key returned by k9-ssh must correspond to the private key the SSH client is offering. Verify by running the login with verbose output:
Look for
Offering public key:lines and compare fingerprints.AuthorizedKeysFile nonenot set, conflicting local file — If the user has a local~/.ssh/authorized_keyswith conflicting entries andStrictModes yes, sshd may reject it before consulting Key9. Check permissions on the local file.Key type not accepted by sshd — Older sshd versions may reject newer key types. Check
sshd_configforPubkeyAcceptedKeyTypesorPubkeyAcceptedAlgorithmsrestrictions.
Enabling More Verbose Logging
k9-ssh always logs to syslog. To see real-time output while testing:
To trace the full sshd session (useful for comparing what sshd receives):
Still Stuck?
Contact Key9 support at support@k9.io and include:
The k9-ssh version (
/opt/k9/bin/k9-ssh --version)Relevant syslog lines from around the time of the failed login
The OS and OpenSSH version (
ssh -V)Output of
sudo -u key9 /opt/k9/bin/k9-ssh --user=<username>(redact any sensitive key material)
Last updated