Ssh – How to resolve the “invalid ELF header” warning when trying to SSH and what does it mean

sshUbuntu

I'm getting some kind of warning when checking my connection to github. Why is it happening and how can I resolve it?

$ ssh -TI ~/.ssh/id_rsa git@github.com
dlopen /home/ubuntu/.ssh/id_rsa failed: /home/ubuntu/.ssh/id_rsa: invalid ELF header
Hi mediapop/Gnossem-Magazine! You've successfully authenticated, but GitHub does not provide shell access.

Best Answer

You mistaken options -i and -I of OpenSSH.

From man ssh:

-I pkcs11 - Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing the user's private RSA key.

-i identity_file - Selects a file from which the identity (private key) for public key authentication is read.

After -I ssh expects shared library and tries to load your id_rsa as shared library, so it expects ELF header.

In this case you can omit -i because ~/.ssh/id_rsa is default file.

Related Question