B
B
BlastPit2018-06-03 23:47:35
SSH
BlastPit, 2018-06-03 23:47:35

How does CentOS7 handle ssh connections?

Tell me, why in CentOS7, when creating an ssh connection to another machine, or when cloning a git repository (via ssh), I can’t connect without running ssh-agent and adding a private part, an earlier generated key, to it? (ssh-add ~/.ssh/other_id_rsa) I haven't used this protocol for a long time and it seemed to me that earlier it was enough to scatter public keys in .ssh folders or in authorized_keys (on remote machines) so that after that, it would be possible to connect instantly. At least when searching for a similar problem, this option is discussed everywhere with the correct distribution of rights to folders and files.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2018-06-04
@BlastPit

ssh by default looks for the $HOME/.ssh/id_rsa file (or id_dsa, etc., you need to look at the configuration)
it knows nothing about other_id_rsa, so this key must be added to the agent.
Other options - rename to id_rsa
And the most correct option is to set up a config file in which you specify that for the remote server x you need to use the private key from the file ~/.ssh/other_id_rsa
example $HOME/.ssh/config

host github.com
  IdentityFile /home/user/.ssh/other_id_rsa

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question