16

After a fresh install of Ubuntu 15.10, when using scp or git clone, I get the following warning (the command itself doesn't fail): key_load_public: invalid format

How can I get rid of this warning?

Update: This is the output of scp -vvv:

OpenSSH_6.9p1 Ubuntu-2, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to ... [...] port 22.
debug1: Connection established.
key_load_public: invalid format
debug1: identity file /home/alexzeitler/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2
  • There should be more than only a key_load_public: invalid format – A.B. Nov 17 '15 at 7:16
  • please, post the whole verbose log. – Jakuje Nov 17 '15 at 9:16
  • @Jakuje Added the verbose output to the question. – Alexander Zeitler Nov 19 '15 at 20:50
  • I meant rather verbose log from scp, such as scp -vvv file remote:file or so to see the context from ssh – Jakuje Nov 19 '15 at 20:53
  • @Jakuje Updated it again - is this sufficient? – Alexander Zeitler Nov 19 '15 at 21:05
33

Check the file /Users/alexzeitler/.ssh/id_rsa. What is there? How did it got there?

It should be your private RSA key, isn't it? And is there something in /Users/alexzeitler/.ssh/id_rsa.pub? Is it valid public key?

If you don't use these keys, remove both of them and the message will disappear. If you are using them in different way, move them somewhere else. The same if they are in different format.

The public part is probably corrupted, so you can recreate it from private one using this command:

ssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub

hostkeys possibility

The other possibility is that client is trying to read server public keys for HostBasedAuthentication. Don't you have it allowed in /etc/ssh/ssh_config ?

It would be one of these files missing or corrupted:

/etc/ssh/ssh_host_ecdsa_key.pub
/etc/ssh/ssh_host_ed25519_key.pub
/etc/ssh/ssh_host_dsa_key.pub
/etc/ssh/ssh_host_rsa_key.pub

Your sshd server is not complaining?

  • The public and private keys are valid when e.g. using them with git + GitHub – Alexander Zeitler Nov 19 '15 at 21:18
  • edited the answer. The server keys can be also the cause in some cases. – Jakuje Nov 19 '15 at 21:25
  • 2
    That one was there before. I believe the public part is corrupted somehow. You can try to regenerate new public key from the private using ssh-keygen -y ~/.ssh/id_rsa. – Jakuje Nov 19 '15 at 21:54
  • 3
    recreating the public key from the private fixed it - thanks for your help and patience! Please update the answer so I can mark it as answer. – Alexander Zeitler Nov 19 '15 at 22:00
  • 5
    Btw the command I used was: ssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub – Alexander Zeitler Nov 19 '15 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.