0

I have two servers where I connect using SSH public key authentication, with different keys. The configuration looks like this:

Host server1
  IdentityFile /path/to/key
  IdentitiesOnly yes

Host server2
  IdentityFile /path/to/other/key
  IdentitiesOnly yes

I add the two keys to the agent and verify via ssh-add -l that both are present. Yet, one works but the other does not:

$ssh -v server1
...
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /path/to/key
debug1: Server accepts key: ...
debug1: Authentication succeeded (publickey).

$ssh -v server2
...
debug1: Next authentication method: publickey
debug1: Trying private key: /path/to/other/key
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/path/to/other/key': 

The OS is Ubuntu 14.04, the output of ssh -V is OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3, OpenSSL 1.0.1f 6 Jan 2014.

5
  • are you sure key for host2 is okay ? debug1: key_parse_private2: missing begin marker
    – Archemar
    Dec 1, 2015 at 13:31
  • I can log in with it after typing the passphrase.
    – Tgr
    Dec 1, 2015 at 22:20
  • @Jakuje to quote from the question, I add the two keys to the agent and verify via ssh-add -l that both are present.
    – Tgr
    Dec 2, 2015 at 19:36
  • Sorry. My bad. What are the types? Normal RSA in openssh format or some pem? There must be some difference.
    – Jakuje
    Dec 2, 2015 at 19:40
  • What's a reliable way to determine that? They certainly look like normal keys - -----BEGIN RSA PRIVATE KEY-----, some properties, a big block of base64 data, -----END RSA PRIVATE KEY-----.
    – Tgr
    Dec 3, 2015 at 2:41

0

You must log in to answer this question.

Browse other questions tagged .