SSH Certificate login to Linux boxes (Rasberry-Pi) from Windows 10 and above

We all know passwords are dead 😀 Everyone should have Certificates to login to the remote system. It was always tricky to do it from window boxes. Putty is amazing tool but hard to do this type of logins

Thanks to MS terminal It’s now very easy. after installing the terminal create the public and private keys on your windows. On your PowerShell type below

ssh-keygen -t ed25519 -b 4096

Once you create the Private and public key

$USER_AT_HOST="your-user-name-on-host@hostname"
$PUBKEYPATH="$HOME\.ssh\id_ed25519.pub"

$pubKey=(Get-Content "$PUBKEYPATH" | Out-String); ssh "$USER_AT_HOST" "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '${pubKey}' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

This will copy your public key to the remote computer.

whenever you type ssh username@remotehost on the MS terminal this will login using the certificate

I got this from this MS doc where they go into details on how to do this very securely. This is just a quick to get it up and running read the doc and do it correctly

Leave a Reply

Your email address will not be published. Required fields are marked *