9

How can I tell ssh to look for config file in a location other than the default one: ~/.ssh/config?

0

2 Answers 2

11

-F configfile

Specifies an alternative per-user configuration file. If a configuration file is given on the command line, the system-wide configuration file (/etc/ssh/ssh_config) will be ignored. The default for the per-user configuration file is ~/.ssh/config.

Source: https://linux.die.net/man/1/ssh

3
  • This works but every time I need to enter the config file path. Is it possible to store this option as default somewhere?
    – motam79
    Commented Sep 12, 2018 at 2:34
  • @motam79 quoting: "[...] the system-wide configuration file (/etc/ssh/ssh_config) will be ignored.". Without system-wide file, you can't store this anywhere. (This is my own assumption without any hard evidence and testing!) Commented Sep 12, 2018 at 8:37
  • @motam79 If you're only starting ssh manually from the command line, you can make a shell alias. If you use other stuff (scripts, binaries, whatever) that look for ssh on the path, you could drop a wrapper script somewhere that has a higher priority than the real binary.
    – pt314
    Commented Sep 12, 2018 at 10:40
7

As of OpenSSH 7.3p1, you can Include other config files in ssh_config.

So, you could add to /etc/ssh/ssh_config:

Include ~/custom_ssh.conf

Don't think this will stop the default ~/.ssh/config from being loaded, however.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .