I have recently been setting up an old Mac Mini as Webserver and NAS server. One of the things I wanted to do was enable ssh key pair login and wondered how one used ssh-copy-id on a Windows machine to get the public key from a local machine to the server. It turns out you can’t but the
cat command can do it just fine.
Here is the template:
type C:\Users\<user>\.ssh\id_rsa.pub | ssh <user>@<remoteserver> 'cat >> .ssh/authorized_keys'
This assumes your public key is in the default location, your home directory under the .ssh directory, if not modify the first part of the command to reflect its location
Another way is to use the git terminal for windows as that has ssh-copy-id installed.
On Mac or Linux or the Git Shell you would just use:
This will copy from local default to remote default locations. As usual Windows is a little more involved but it works fine and it isn’t too hard to understand what is happening.