ssh public key problem: /usr/bin/ssh-copy-id: ERROR: No identities found

5,792

ssh-copy-id expects the user's public key file to be located in ~/.ssh - specifically:

 The default_ID_file is the most recent file that matches: ~/.ssh/id*.pub,
 (excluding those that match ~/.ssh/*-cert.pub) so if you create a key
 that is not the one you want ssh-copy-id to use, just use touch(1) on
 your preferred key's .pub file to reinstate it as the most recent.

Correspondingly, that's where ssh-keygen writes generated keys by default - if you chose a non-default file location when you ran ssh-keygen, then you can specify that to ssh-copy-id using the -i option:

 -i identity_file
         Use only the key(s) contained in identity_file (rather than look‐
         ing for identities via ssh-add(1) or in the default_ID_file).  If
         the filename does not end in .pub this is added.  If the filename
         is omitted, the default_ID_file is used.
Share:
5,792

Related videos on Youtube

user1172131
Author by

user1172131

Updated on September 18, 2022

Comments

  • user1172131
    user1172131 over 1 year

    I have two users each with their own computers running Ubuntu. I want to remotely access one of them (say the desktop server) from the other one (say the client pc).
    I'm trying to enable public key based authentication following the relative section in this answer (Connect two computers with SSH in a home LAN). I started with the command from the client pc

    ssh-keygen -t rsa -b 4096
    

    After setting the file in which to save the key and the passphrase I launch the following command:

    ssh-copy-id [email protected]
    

    where emanuele@emanuele-desktop is the user@comp of the desktop server to which I'd like to remotely access

    /usr/bin/ssh-copy-id: ERROR: No identities found
    

    Any idea of what I'm missing?

    • steeldriver
      steeldriver about 3 years
      "After setting the file in which to save the key" did you save it to a non-default location? if so, you will need to specify that via the ssh-copy-id's -i option
    • user1172131
      user1172131 about 3 years
      Thank you steeldriver, I've eliminated the old file and recreated in the default location
    • steeldriver
      steeldriver about 3 years
      OK I've added a more complete answer below