{
  "id": 8270797,
  "title": "SSH Permission Denied (publickey): The Real Fix",
  "url": "https://urgent.news/2026/09/18/ssh-permission-denied-publickey-the-real-fix",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-18T16:37:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mrsaynothing/ssh-permission-denied-publickey-the-real-fix-22p1"
  },
  "original_language": "en",
  "account": "The error \"Permission denied (publickey)\" occurs when every key offered by the client during an SSH connection is refused by the server. This is a negotiation result, not a password typo. To diagnose the issue, use \"ssh -vvv\" to see the keys offered and the server log \"journalctl -u ssh\" to see which keys are refused and why. The four possible causes are:\n\n1. Wrong user: The key is installed for a different user than the one you're trying to connect to.\nSolution: Use the correct user when running the SSH command.\n2. Key missing from authorized_keys: The key is not present in the target user's ~/.ssh/authorized_keys file.\nSolution: Add the key to the authorized_keys file and set proper permissions: chmod 700 ~/.ssh and chmod 600 ~/.ssh/id_ed25519 ~/.ssh/authorized_keys\n3. Permissions too open: The private key file has incorrect permissions, making it inaccessible to the SSH client.\nSolution: Set strict permissions: chmod 700 ~/.ssh and chmod 600 ~/.ssh/*\n4. ssh-rsa key refused by OpenSSH 8.8+: The server's OpenSSH version has disabled ssh-rsa signatures by default, while the key used may still be signed with the legacy format.\nSolution: Regenerate the key as ed25519, or upgrade the key to a supported format.\n\nUsing \"ssh-copy-id\" can help prevent recurrence of the issue, as it adds the public key to the authorized_keys file with proper permissions and handles potential issues like trailing newlines.",
  "summary": "Originally published at mrsaynothing.dev . At 02:10 a deploy died on a line I have typed a thousand times: ssh deploy@staging → Permission denied (publickey) . The key was fine. The offer wasn't. TL;DR: Permission denied (publickey) means every key the client offered was refused by the server — a negotiation verdict, not a password typo. Diagnose with ssh -vvv (which keys were offered) and the…",
  "key_points": [
    "Error \"Permission denied (publickey)\" occurs when server refuses all offered keys",
    "Causes include wrong user, missing key, overly permissive permissions, or disabled ssh-rsa format"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}