Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the default ssh key location

Tags:

ssh

ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location.

The workaround I'm using is to add the keys from the non-standard location to the agent:

ssh-agent ssh-add /path/to/where/keys/really/are/id_rsa  

(on Linux and MingW32 shell on Windows)

like image 857
tardate Avatar asked Sep 17 '08 14:09

tardate


People also ask

Where is default SSH key location?

By default, the keys will be stored in the ~/. ssh directory within your user's home directory. The private key will be called id_rsa and the associated public key will be called id_rsa.

How do I set a default SSH key?

ssh with the private key named id_rsa and the public key named id_rsa. pub . By using the default file names, the SSH client will be able to automatically locate the keys during authentication so it is strongly recommended to not change them. You can use the default by pressing the Enter key.

Where are SSH keys saved?

You keep the private key a secret and store it on the computer you use to connect to the remote system. Conceivably, you can share the public key with anyone without compromising the private key; you store it on the remote system in a . ssh/authorized_keys directory.


1 Answers

If you are only looking to point to a different location for you identity file, the you can modify your ~/.ssh/config file with the following entry:

IdentityFile ~/.foo/identity 

man ssh_config to find other config options.

like image 52
Drew Frezell Avatar answered Oct 04 '22 13:10

Drew Frezell