I have multiple websites hosted with the same provider. This means that access via SSH is the same 'host' for all.

I have been adding a version of the following to my SSH config file for each site:

Host shell.grid.co.uk
User testuser
IdentityFile ~/.ssh/id_rsa_testuser

I now have 6 sites in my config and am unable to connect to SSH via terminal.

I am getting the following error:

Received disconnect from [IP ADDRESS] port 22:2: Too many authentication failures for [USER]

I have been doing some research and wonder if this has something to do with MaxAuthTries?

If I remove 1 or more of the items from the config file, I can then log on via SSH on terminal.

All of these websites are on a shared hosting platform, if that makes any difference.

  • are you using ControlMaster to bundle duplicate connections over the first one?
    – thrig
    Jun 21, 2018 at 20:34
  • @thrig No. I'm pretty new to SSH. I'm learning, but its a rather steep learning curve. Any guidance would be appreciated.
    – ccdavies
    Jun 21, 2018 at 20:40

1 Answer 1


You're on the right track, but I think you might benefit from breaking out the configuration with aliases for each user within your ~/.ssh/config:

Host site1
  HostName shell.grid.co.uk
  User site1user
  IdentityFile ~/.ssh/id_rsa_site1user

Host site2
  HostName shell.grid.co.uk
  User site2user
  IdentityFile ~/.ssh/id_rsa_site2user

Host sitetest
  HostName shell.grid.co.uk
  User testuser
  IdentityFile ~/.ssh/id_rsa_testuser

This way your SSH client should only use the one specific key for each user. You would simply ssh site1 and your configuration would add the correct username and private key.

  • Thank you! That has worked. I will read up on the use of 'host'.
    – ccdavies
    Jun 21, 2018 at 21:23

You must log in to answer this question.

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