Fix - ssh-copy-id no identities found error


Error:
# sh-copy-id root@192.169.1.123
/usr/bin/ssh-copy-id: ERROR: No identities found
ssh-copy-id no identities found error
Solution:

Fix 1: You need to add an option -I followed by your pub key location.

Syntax:
ssh-copy-id [-i [identity_file]] [user@]machine
Example:
# ssh-copy-id -I my-key.pem admin-user@192.169.1.123

Note: The pem key should be at the ./ssh/keyname.pem or the user /home directory.

Fix 2: If you do not have the .pem key, you first need to generate it using ssh-keygen command,

# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): mykey
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in mykey.
Your public key has been saved in mykey.pub.
The key fingerprint is:
SHA256:NLc+NeahlR1fi/MrQErjPDVjP3U412CGZ0UkzpUrDFY root@3fb331332832
The key's randomart image is:
+---[RSA 2048]----+
|            .E+=*|
|           o.+++.|
|        o o oo+++|
|       . = B =+==|
|        S S @o+oo|
|         * C =o  |
|          = o .. |
|           . .  .|
|              .. |
+----[SHA256]-----+
-

Facing issues? Have Questions? Post them here! I am happy to answer!


Author Info:

Rakesh (He/Him) is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap