Can I use ssh-copy-id-windows to copy the public key from windows to Ubuntu?

560    Asked by AndreaBailey in SQL Server , Asked on Dec 22, 2021

 What can I do to copy the SSH public keys from windows to Ubuntu?  I found an article about the copying of ssh keys to windows and came across this paragraph - At the moment, Windows 10’s implementation of the OpenSSH client does not have the ssh-copy-id command available. However, a PowerShell one-line command can mimic the ssh-copy-id command and allow you to copy an SSH public key generated by the ssh-keygen command to a remote Linux device for passwordless login.

Answered by Andrew Jenkins

The following steps can be followed to ssh copy id windows -

1. EDIT Download cmder or use your favorite console emulator. Move your public key 

(id_rsa.pub) and your private key (id_rsa) to C:UsersyourUserName.ssh create the .ssh folder if needed.

2. On your windows host via cmder:

cp C:UsersyourUserName.sshid_rsa.pub C:UsersyourUserNameuthorized_keys

3. On your ubuntu host:

service ssh status Start sshd if necessary

mkdir ~/.ssh/ (if it doesn't already exist)

4. On your Windows host via cmder:

cd C:UsersyourUserName

scp authorized_keys login-id@ubuntu-Host-Ip:~/.ssh

5. On your Ubuntu host:

chmod 700 ~/.ssh

chmod 600 ~/.ssh/authorized_keys

6. On your Windows host via cmder:

Test if you can ssh into your ubuntu host without login/pw auth. If yes:

rm C:UsersyourUserNameuthorized_keys



Your Answer

Interviews

Parent Categories