Skip to main content

Linux command: ssh-copy-id


ssh-copy-id copy ssh public key to remote host

ssh-copy-id - install your identity.pub public key in a remote machine’s authorized_keys

Syntax

ssh-copy-id [-i [identity_file]] [user@]machine

Copy ssh public key to host 192.168.64.115

[tuyen@rhel5 ~]$ ssh-copy-id -i ~/.ssh/tuyenid_rsa.pub tuyen@192.168.64.115
32
The authenticity of host '192.168.64.115 (192.168.64.115)' can't be established.
RSA key fingerprint is 34:75:a1:bc:f4:15:d6:19:e6:0b:3b:cf:04:74:d0:c3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.64.115' (RSA) to the list of known hosts.
tuyen@192.168.64.115's password:
Now try logging into the machine, with "ssh 'tuyen@192.168.64.115'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[tuyen@rhel5 ~]$

ssh to 192.168.64.115 using ssh private key

[tuyen@rhel5 ~]$ ssh -i .ssh/tuyenid_rsa tuyen@192.168.64.115
Last login: Tue Jun 18 11:29:06 2019 from 192.168.64.102
[tuyen@ol7 ~]$

Copy SSH public key from Microsoft Windows to Linux

PS C:\Users\tuyen> type .\.ssh\tuyenid_rsa.pub | ssh tuyen@192.168.64.115 "cat >> .ssh/authorized_keys"

Popular posts from this blog

SoloLearn: Learn to Code for Free!

Got a minute? You can learn to code anywhere, anytime you can with your smartphone using Sololearn.

Data Recovery Softwares

Follow 3-2-1 backup rule so you do not need these data recovery softwares.

Microsoft Windows 10 1903

Check for new feature at What's new in Windows 10, version 1903 IT Pro content