title: ssh config use identity file for user
body: <p>I am trying to set up ssh config so that if I am sshing using a particular user then use a different key.</p>
  
  <p>By default I want to ssh using my username (abcd) and my identity (~/.ssh/id_rsa)</p>
  
  <p>eg) "ssh example.com" uses user abcd and ~/.ssh/id_rsa ... all good :D</p>
  
  <p>But if I ssh using ssh defg@example.com i want to use the identity file ~/.ssh/id_defg_rsa</p>
  
  <p>eg) "ssh defg@example.com" should use user defg and ~/.ssh/id_defg_rsa</p>
  
  <p>I tried:</p>
  
  <pre><code>User defg
      IdentityFile ~/.ssh/id_defg_rsa
  </code></pre>
  
  <p>I know I can use an alias but I was wondering if I could just set it up in ssh_config. I know you can condition on the Host, but i am wondering if I can also condition on a user.</p>