To use ssh-id-copy do you need both id_rsa.pub and id_rsa?
I am trying to setup a second access ssh key for a friend. He sent me his id_rsa.pub.
ssh-copy-id -i id_rsa.pub [email protected]
/usr/local/bin/ssh-copy-id: ERROR: failed to open ID file './id_rsa': No such file or directory
Do I need him to send me both files?
The ssh-copy-id
command from OpenSSH fails if there is no private key file with the same name available, because it tries to login with the specified key to check if it is already present on the remote server.
In recent versions you can override this behavior with the -f
switch ("Forced mode").
From the man page:
-f
Forced mode: doesn't check if the keys are present on the remote server. This means that it does not need the private key. Of course, this can result in more than one copy of the key being installed on the remote system.
The .pub
is sufficient. You are not in the correct folder.
You can try this :
ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected]
(for the root user : not recommended, it's just an example).
This file is under the .ssh
folder on the user folder.
This has been reported as OpenSSH bug #2110.