Passwordless SSH Login

Typically when you SSH into a machine, you’re required to provide a username & password.

On Linux and Mac endpoints, it's possible to use a command ssh-copy-id which copies your endpoints authorized key to the server, allowing passwordless login. The Windows open-ssh Powershell implementation does not have this command, so we need to get creative. 

This guys shows how to copy SSH Keys from a Windows client, to a macOS Server.

Terminology:
Client: The device that you are working from, and will be using to access the remote machine. Our client in this case is a Windows endpoint. 
Server: The device that you will be remoting into. Our Server in this case is a macOS endpoint. 

Client Configuration :

1. Open Terminal, or Windows Powershell.

PS: ssh-keygen        

2. Connect to your server, using the command below.

PS: type $env:USERPROFILE\.ssh\id_rsa.pub | ssh user@macOS-ipAddress "cat >> .ssh/authorized_keys"   

3. Try SSH'ing into your server again, and you will notice you are no longer prompted for a password!

This article was updated on October 27, 2022