How To Solve ssh-copy-id “ERROR: failed to open ID file” Error


ssh provides secure access to the remote systems console or command line. All linux boxes uses ssh securely. There are a lot of steps to make things secure and easy while connecting and using ssh. ssh provides passwordless authentication with certificates. We can use ssh-copy-id to send our certificate to the remote system but what can we do if we get following error

/usr/bin/ssh-copy-id: ERROR: failed to open ID file '/home/ismail/.pub': No such file 
        (to install the contents of '/home/ismail/.pub' anyway, look at the -f option)

Try ssh-copy-id

Now we want to copy our ssh public certificate with ssh-copy-id command. We just provide the remote host we want to copy. The user will be the current username which is ismail in this case. We can also specify the username like [email protected] .

$ ssh-copy-id poftut1

Generate Certificates with ssh-keygen

As we see from the error text we do not have any certificate pair. I call it certificate pair because there is two certificate named public and private . private certificate is hold securely in our system and public certificate is distributed to the other systems. We will use ssh-keygen to create a certificate pair with default settings. More detailed about ssh-keygen can be found following post.

How To Generate Ssh Key With ssh-keygen In Linux

$ ssh-keygen
Generate Certificates with ssh-keygen
Generate Certificates with ssh-keygen

Copy Certificates with ssh-copy-id

Now we can copy our certificate to the remote system without problem.

$ ssh-copy-id poftut1
Copy Certificates with ssh-copy-id
Copy Certificates with ssh-copy-id

LEARN MORE  How To Use mRemoteNG For RDP, VNC, SSH Remote Connections?

Leave a Comment