Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two hosts (A and B) with the same public key stored in ~/.ssh/authorized_keys. Why am I able to ssh between them without a password. The keypair was generated on a third host (C), so I am confident the private key is not available on either A or B.

Update: Answered my own question, and prompting from heavyd was helpful. Turns out I had 'OpenSSH Agent Forwarding' turned on on my local SSH client. The local SSH client (machine C) does have access to the private key, and was acting as agent to authenticate machine A to machine B. This is not what I want, and I'm turning off Agent Forwarding in my client.

tl;dr: Agent Forwarding

share|improve this question
    
Does commenting out the key (put a # at the beginning of the line) change anything? – heavyd Mar 13 '13 at 14:50
    
If I comment out the key (on both hosts' authorized_keys), I am forced to use a password. – mwhidden Mar 13 '13 at 14:52
    
But the three hosts don't share the same home-directory, and hence ~/.ssh, do they? – mpy Mar 13 '13 at 14:53
3  
Running ssh -vv user@host should tell you which key is getting used. – heavyd Mar 13 '13 at 14:54
2  
You can post your answer as an answer and mark it as accepted if you want. – Jan Schejbal Mar 13 '13 at 15:24
up vote 0 down vote accepted

Answered my own question, and prompting from heavyd was helpful. Turns out I had Agent Forwarding turned on on my local SSH client. The local SSH client (machine C) does have access to the private key, and was acting as agent to authenticate machine A to machine B. This is not what I want, and I'm turning off Agent Forwarding in my client.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .