Generate Key Pair (Recommended Settings)
ssh-keygen -t rsa -b 4096
Copy Public key to Remote host
# on main computer ssh-copy-id to remote computer ssh-copy-id USER@server.ip.here # enter password
Copying Public Key to Remote Host (windows 10, powershell)
Get-Content -Path "$env:USERPROFILE/.ssh/id_rsa.pub" | ssh USER@server.ip.here "cat >> .ssh/authorized_keys"
Give correct permissions to .ssh files:
chmod 755 ~/.ssh chmod 755 ~/.ssh/authorized_keys chmod -R 755 ~/.ssh #or chmod -R 700 ~/.ssh
Revoke ssh key fingerprint:
ssh-keygen -R server.ip.here
ssh-keygen -R "[server.ip.here]:PORT"
Convert linux ssh key from ssh2 to PEM and back
WARNING: This will overwrite the key, but is easily converted back
ssh-keygen -p -f id_rsa -m PEM
ssh-keygen -p -f id_rsa -m SSH2