Setting the default ssh key location

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)

Best Solution

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.