Configure SSH Key-Based Authentication between Windows and Linux

# Install Open SSH using Powershell
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

# Create an SSH key pair. Enter file in which to save the key, and a passphrase if needed
ssh-keygen

# SSH to the server
ssh user@server

# Create the SSH directory and set permissions
mkdir ~/.ssh
chmod 700 ~/.ssh
exit

# Copy the public key to the server
type $env:USERPROFILE\.ssh\id_rsa.pub | ssh 192.168.1.225 "cat >> .ssh/authorized_keys"

To connect with Putty:

  • Open PuttyGen
  • Conversions > Import Key > open the .rsa file
  • Save Private Key > save as a .ppk file
  • In a new Putty connection:
    • Enter Hostname
    • Connection > Data > enter Auto-login hostname
    • Connection > SSH > Auth > Credentials > Browse private key file for authentication

Leave a Reply