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

Install Microsoft .NET Core SDK

.NET Core Software Development Kit (SDK) is a set of libraries and tools that allow developers to create .NET Core applications and libraries.

How to charge your device from USB Port

First of all, check BIOS Settings of your laptop or desktop Dell Look for USB PowerShare BIOS Settings: USB PowerShare Lenovo Look for Always On USB Charge in Off Mode BIOS Settings: Enable Always On USB Charge in Off Mode

Kali Linux on Raspberry Pi 2

Download Kali Linux for Raspberry Pi 2 Use xzcat to decompress and then dd to image Kali Linux to microSD on Windows 10. or use 7-zip to extract kali-linux-2019.1-rpi3-nexmon.img image file, then use rufus to write image to microSD card Login Kali Linux with default username root and password toor Tight VNC Server root@kali:~# apt install tightvncserver root@kali:~# vncserver :1 You will require a password to access your desktops. Password: Warning: password truncated to the length of 8. Verify: Would you like to enter a view-only password (y/n)? n xauth: file /root/.Xauthority does not exist New 'X' desktop is kali:1 Creating default startup script /root/.vnc/xstartup Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/kali:1.log root@kali:~# Kill vncserver root@kali:~# vncserver -kill :1 Killing Xtightvnc process ID 16102 root@kali:~#