How to send ssh key to linux ssh server passing the remote user it should connect to?
I have a windows server ssh client trying to send a generated ssh public key to a linux ssh server.
openssh for windows doesn't have ssh-copy-id so I found this alternative through powershell:
type $env:USERPROFILE.ssh\id_rsa.pub | ssh {IP-ADDRESS-OR-FQDN} "cat >> .ssh/authorized_keys"
the problem is, it assumes the user to authenticate in order to send the public key is the windows user, in this case "administrator" however the remove server user is "root". How can tell this "type" command it should use "root" user instead of "administrator"?
Instead of ssh 10.0.0.20
use ssh [email protected]
.