I have a set of SSH keys working correctly, but I now need multiple keys for connection to other servers.

I have set up a new set of keys for the new server, adding an identifier to the files of 'lightand'. The keys are:


I have added the public key into the 'authorized_keys' file and placed the private key on my local machine (in .ssh folder).

On the local machine, I have then set up a 'config' file and added the following:

Host lightand@servers.prgn.com
IdentityFile ~/.ssh/id_rsa_lightand

I have then run:

eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa_lightand

However, with the above completed, I still get a password prompt through terminal.

Does anyone have any ideas on where I have gone wrong?

  • 3
    Your Host line should have just the hostname and you should add a line underneath with User lighthand. If that doesn't work, show us the output from ssh -v – Liczyrzepa Jun 7 '18 at 19:42

In your case, the ssh config file contained an error preventing it from loading the appropriate key.

Host lightand@servers.prgn.com

Since the hostname is only servers.prgn.com, that host line will never match when you ssh to servers.prgn.com. The configuration file requires that usernames be on a separate line. Changing the configuration to the following should fix your issue:

Host servers.prgn.com
    User lightand
    IdentityFile ~/.ssh/id_rsa_lightand

If you ever need to see what your ssh client is doing behind the scenes as it is running, just use ssh -v.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.