Subject: I cannot make more than one ssh-key working, is it normal ?
I am working on 2 workstations, I use one to debug my code and then upload it on the cluster and one to download the data and make the plots.
I was able to generate one key pair for the plotting computer using
ssh-copy-id -i ~/.ssh/key_name.pub user@remote_host
It is working well, I wanted to add another one using the same commands on the second computer.
The two keys are added in the
~/.ssh/authorized_keys file but the connection from the second computer is always refused
ssh: connect to host baobab2.hpc.unige.ch port 22: Connection refused.
I saw on this page: https://my-account.unige.ch/main/home it is possible to add a key, but only one.
Thank you for your help,
This won’t fix your issue, but please update the url:
Indeed, this is done on purpose. You should use the same private key on your two workstation. This isn’t a security issue since your protect it with a passphrase. Do you? Beware there are several a delay of several hours for the propagation to take effect.
can you sent us an email from the ssh log with verbose output enabled
ssh -vvv email@example.com
Thank you !
I changed baobab2 by login2.baobab everywhere, sorry.
the Julia package I use to interact with the cluster does not allow it. I prefer to change my private key from time to time…
Using the same private key it is working well now (after delay).
Do you still want the
ssh -vvv by email ?
Thank you again.
You should then try to use an ssh agent. When you connect to an ssh server that requests this key, you won’t be prompted for the passphrase until you close your session.
(baobab)-[sagon@admin1 ~]$ eval $(ssh-agent)
Agent pid 52332
(baobab)-[sagon@admin1 ~]$ ssh-add
Enter passphrase for /home/sagon/.ssh/id_rsa:
Identity added: /home/sagon/.ssh/id_rsa (/home/sagon/.ssh/id_rsa
You mean your public ssh key is in my-account? In this case it probably meant the key copied in
authorized_keys was never working.
It is up to you. As it is working for you now, this is not strictly needed.
Thank you, I didn’t know the existence of such a thing !
I copied the pair of keys of the working computer on the other one. It was working well long before adding the ssh key to my-account. I didn’t know about the the my-account thing before trying to understand why I couldn’t connect with the second computer.
If you want to investigate: one thing to check is the user rights on the private key file. If it is too much open, ssh refuses to use it for security reason.
Yes, I had to modify the user rights using chmod (If I remember correctly the rights should be rw-r–r–). Also I think it is possible to pass through this by creating a key and then copy-past the true key in the file.