SSH Keys

ssh-keygen -t rsa -b 4096
Copy Public key to Remote host
# on main computer ssh-copy-id to remote computer
# enter password

Copying Public Key to Remote Host (windows 10, powershell)

Get-Content -Path "$env:USERPROFILE/.ssh/" | ssh "cat >> .ssh/authorized_keys"

Give correct permissions to .ssh files:

chmod 755 ~/.ssh
chmod 755 ~/.ssh/authorized_keys
chmod -R 755 ~/.ssh

chmod -R 700 ~/.ssh

Revoke ssh key fingerprint:

ssh-keygen -R

with port

ssh-keygen -R "[]: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