J
J
Juniorrrrr2021-12-17 17:22:24
SSH
Juniorrrrr, 2021-12-17 17:22:24

How to choose an ssh key?

Please tell me, I have an ssh key on one project, it is called id_rsa.pub , another project has appeared and there is also a key with the same name, so that the files do not conflict, I put the second key in another folder.
that is:
1) id_rsa.pub
2) testFolder/id_rsa.pub

And when I try to enter via cmd to the server 2 of the project, it immediately asks for a password and it feels like by default it sees id_rsa.pub in the ssh folder and uses it.

Please tell me if I'm thinking correctly and if so, how to specify the path to ssh for a specific session
. That is, conditionally, I opened cmd -> ssh [email protected] and entered the path to the desired ssh

. I work under windows 10

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
KhodeN, 2021-12-17
@Juniorrrrr

There are three options:
1. Use one key, the second is not needed. Keys are personal data, everyone has their own private key, and where necessary, the public part is written.
2. Register the key in the SSH Agent `ssh-add ~/.ssh/testFolder/id_rsa` (it can be difficult on Windows)
3. Specify the key when connecting: `ssh -i ~/.ssh/testFolder/id_rsa [email protected]`

B
bankinobi, 2021-12-17
@bankinobi

When you generate a key (or a ready-made one, just rename the pair) specify the key name with reference to the project: id_rsa_project1 and id_rsa_project1.pub and specify the required key when connecting: ssh -i ~/.ssh/id_rsa_project1 [email protected]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question