0

I get this error when running ssh-add. The command seems to work after this, but the return code is 127 (so a script runs into an error at this point). Does anyone recognize the error? Google doesn't seem to.

$ eval `ssh-agent`
Agent pid 19527

$ ssh-add ~/.ssh/my_id_rsa
Enter passphrase for /home/davidparks21/.ssh/my_id_rsa: 
Identity added: /home/davidparks21/.ssh/my_id_rsa (/home/davidparks21/.ssh/my_id_rsa)
add_file: key_cert_copy: invalid argument

Added details

ssh -v localhost
OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g  1 Mar 2016

ssh-add ./id_rsa                                   # No passphrase
Identity added: ./id_rsa (./id_rsa)
add_file: key_cert_copy: invalid argument

Odd note: when I ran this test and echo $? to check the exit status I see an exit status of 0, different from what I saw when I originally wrote this question.

  • Which operating system ? – Arushix May 29 '18 at 17:27
  • Linux Mint 18.3 / Ubuntu 16.04, added to the tags. – David Parks May 29 '18 at 17:30
  • 1
    And which version of ssh[-agent]? – user4556274 May 29 '18 at 17:36
  • 1
    I haven't attempted to find the source code used to build the OpenSSH packages on your OS, but a from a quick reading of the tip of the master branch, there are two reasons you could see this error: either your pubkey is empty, or your pubkey has too many principals. It is also possible that the error is caused by a bug in the sshkey_load_public function. – jayhendren May 29 '18 at 18:44
  • 1
    Presumably if you execute ssh-add -k ~/.ssh/id_whatever, you don't get the error message? And do you have a file with the naming convention of a corresponding certificate ~/.ssh/id_whatever-cert.pub ? – user4556274 May 29 '18 at 18:51

Your Answer

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

Browse other questions tagged or ask your own question.