SSH keys and GitHub

Fix "UNPROTECTED PRIVATE KEY FILE" and "bad permissions"

SSH refuses a key that other users could read. Make it private to you.

  1. Lock down your SSH folder and key
    Terminal
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/id_ed25519
    chmod 644 ~/.ssh/id_ed25519.pub

Check it worked

  1. Check the permissions
    Terminal
    ls -l ~/.ssh

    The key should show -rw-------.

  1. Lock down your SSH folder and key
    Terminal · Ubuntu / Debian
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/id_ed25519
    chmod 644 ~/.ssh/id_ed25519.pub

Check it worked

  1. Check the permissions
    Terminal · Ubuntu / Debian
    ls -l ~/.ssh

    The key should show -rw-------.

  1. Make the key readable by you only
    PowerShell
    icacls "$env:USERPROFILE\.ssh\id_ed25519" /inheritance:r /grant:r "$($env:USERNAME):(R)"

Check it worked

  1. Check the permissions
    PowerShell
    icacls "$env:USERPROFILE\.ssh\id_ed25519"

    Only your user should be listed.