2

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:

id_rsa_lightand
id_rsa_lightand.pub

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 [email protected]
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?

1
  • 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
    Commented Jun 7, 2018 at 19:42

1 Answer 1

1

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

Host [email protected]

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.

You must log in to answer this question.

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