Bug 2794 - ssh-copy-id should use the same default identity file as ssh
Summary: ssh-copy-id should use the same default identity file as ssh
Status: CLOSED WONTFIX
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-copy-id (show other bugs)
Version: 7.6p1
Hardware: Other Linux
: P5 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-15 12:20 AEDT by krumelmonster
Modified: 2021-03-04 09:52 AEDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description krumelmonster 2017-10-15 12:20:33 AEDT
ssh-copy-id when invoked without -i will default to the most recently created identity file while ssh defaults to ~/.ssh/id_dsa, ~/.ssh id_ecdsa, ~/.ssh/id_ed25519 and ~/.ssh/id_rsa.

The expected behavior is that ssh-copy-id uses the same identity file that ssh would use so that a successful ssh-copy-id allows pubkey authentification without further configuration.
Comment 1 Philip Hands 2020-09-17 06:21:06 AEST
Sorry for ignoring this bug for so long.

The current behaviour is useful, since one can, for example, create a .pub file containing the several keys you want installed, some from other machines such that the private keys are not available, and have them all be added despite it not being something that ssh would be able to use becuase it does not have matching private key files.

Of course, now that ssh-copy-id attempts to login to test if keys are already installed, one now needs to specify -f to make it work with such a combined id file.

Since you find this unhelpful, you just need to follow the advice in the man page:  touch the file for the key that you want installed, and it will be chosen as the most recent.

HTH

Cheers, Phil.
Comment 2 Damien Miller 2021-03-04 09:52:51 AEDT
close bugs that were resolved in OpenSSH 8.5 release cycle