How to Fix SSH Permission Denied (publickey)
Use ssh -vvv to tell whether your key was never offered, the server rejected it, or signing failed. Match the log to the next check on the client or server.
Permission denied (publickey) means SSH could not finish logging you in with a public key. Run ssh -vvv user@example.com and follow one key’s fingerprint through the output. The final error is the same whether your client skipped the key, the server rejected it, or your agent couldn’t sign with it.
Inspect which key SSH offers
Find the SHA256:… fingerprint of the public key you intended to use, then compare it with the verbose connection log:
ssh-keygen -lf ~/.ssh/id_ed25519.pub
ssh -vvv user@example.com
| What the log shows for that fingerprint | What to check next |
|---|---|
Your key is missing from the attempt, or Trying private key is followed by no such identity |
Inspect the local key path, effective SSH config, and loaded agent identities. |
Offering public key followed by Authentications that can continue: publickey without Server accepts key |
Verify the remote username and compare the offered fingerprint with the keys authorized for that account. Check the server log for the reason. |
Server accepts key followed by sign_and_send_pubkey: signing failed |
The server recognized the public key. Check the local private key, agent, or hardware token that must sign the request. |
Use the same alias you normally connect to when inspecting the client configuration. For a file-backed key, the last command makes an explicit attempt with that identity:
ssh -G user@example.com | grep -E '^(hostname|port|user|identityfile|identitiesonly|identityagent) '
ssh-add -l
ssh -vvv -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 user@example.com
Check local key permissions
If the client prints UNPROTECTED PRIVATE KEY FILE and ignores a private key you own, restrict access to that file on the client:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
If the log says agent refused operation, check that the expected agent is unlocked. If you use a hardware key, connect it and respond to its PIN or touch prompt when requested. The public key can be visible to SSH even while the signing device is unavailable. Troubleshoot SSH agent signing failures
Verify the server account and authorized key
Check the Authenticating to … as 'user' line. If you meant to log in as deploy, a matching key in another user’s home directory won’t authorize deploy. Through an existing session or console, run the following as the target account on the server for the default authorized-keys location:
whoami
ssh-keygen -lf ~/.ssh/authorized_keys
ls -ld ~ ~/.ssh ~/.ssh/authorized_keys
Compare the remote fingerprints to the one from the client. If yours is missing, have the administrator install your public key for that account. Sites using a custom AuthorizedKeysFile, a key lookup service, or SSH certificates should check their configured authorization source.
If the server log reports bad modes and this account manages its own files, the usual permissions are:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
With StrictModes enabled, check ownership and group or other write access along the path, including the home directory. Limit permission changes to the path identified in the log.
Read the authentication logs
On Ubuntu or Debian:
sudo tail -n 100 /var/log/auth.log
On Fedora, RHEL, or another systemd-based distribution:
sudo journalctl -u sshd -n 100 --no-pager
Match the timestamp and account to your connection attempt. Where Ubuntu or Debian uses the journal, try sudo journalctl -u ssh -n 100 --no-pager. Look for an ownership problem, an unrecognized account, or an algorithm rejected by policy.
Diagnose it with Rumus

Rumus is an AI-native terminal that connects to your real SSH hosts and understands the active connection context. It can inspect SSH configuration, identities, network paths, and server logs instead of guessing from an isolated chat.
What Rumus can inspect
- SSH config, keys, and effective connection settings
- Jump hosts, proxies, ports, and network reachability
- Server authentication logs and file permissions
Connect to the host or open the relevant local workspace in Rumus and ask:
Diagnose why this SSH connection returns Permission denied (publickey).
Check the offered identities, SSH config, key permissions, target account,
and available server authentication logs. Explain every proposed change
before running it.
Rumus can inspect the actual environment, propose a step-by-step plan, and ask for approval before executing changes. This is especially useful when several SSH config entries, jump hosts, or keys may affect the connection.
Confirm the fix
Reconnect with your usual SSH command and add -v. Look for Authenticated to and using "publickey" after the signing step. If the log reports partial success, the key worked and the server requires another authentication step. Keep the private key on the client.
Open the server in Rumus and let the AI agent inspect context, propose a plan, and ask before it runs changes.