Timeline for How can I use a private key in an ssh client for only one host?
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 13, 2022 at 3:46 | comment | added | Criggie | Additionally, the Host line can have multiple entries appended, space separated. | |
| Apr 12, 2022 at 18:27 | vote | accept | quber | ||
| Apr 12, 2022 at 18:11 | history | edited | Nick Matteo | CC BY-SA 4.0 |
added 268 characters in body
|
| Apr 12, 2022 at 18:04 | comment | added | Kamil Maciorowski |
@quber See man 5 ssh_config where it describes IdentityFile. ~/.ssh/id_rsa is used by default (i.e. also for the other server in your case). Use a non-default name for the key you don't want to be used automatically. Then specify the renamed key in the config file like the answer says. I think the answer deliberately named the example key my_idfile, not id_rsa.
|
|
| Apr 12, 2022 at 17:54 | comment | added | quber | i created this config, but does't work Host vds <public_ip> IdentityFile ~/.ssh/id_rsa User root but when i connect to another server in local network ssh 192.168.1.4 Enter passphrase for key '/home/<User>/.ssh/id_rsa': | |
| Apr 12, 2022 at 17:44 | history | answered | Nick Matteo | CC BY-SA 4.0 |