Ssh-copy-id does nothing (used to work fine)

I’m not 100% when this started, but I had a script that I used as of a few weeks ago that worked.

I’m doing something like:

ssh-copy-id [email protected]

It used to work, prompting me for the connection’s password. Now it does nothing. Literally outputs nothing - it drops down to the next line in terminal and sits until I ctrl+c it.

Also, it used to work when I had the following line in my bash script:

sshpass -p $3 ssh-copy-id $2@$1 -p 22

That also returns no output.

…any ideas? :confused:

So, not sure what the problem is but I doubt something changed in ssh-copy-id.

Possible reasons that come to mind:

  • SSH Port changed on target machine
  • Firewall between you and target machine is dropping packets aimed at port 22
  • You changed the client machine and didn’t generate a ~/.ssh/id_rsa file for the new machine
  • ~/.ssh/id_rsa is encrypted by passphrase
1 Like

Shouldn't that be:

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

Maybe I'm wrong, but that's what I always do.

Pretty sure default file is ~/.ssh/id_rsa.pub if no file is specified through -i option (and it exists).

Corresponding line from /usr/bin/ssh-copy-id

DEFAULT_PUB_ID_FILE="$HOME/$(cd "$HOME" ; ls -t .ssh/id*.pub 2>/dev/null | grep -v -- '-cert.pub$' | head -n 1)"