Non-default location for ssh config file in Linux

Non-default location for ssh config file in Linux



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


ssh


~/.ssh/config




2 Answers
2



-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






This works but every time I need to enter the config file path. Is it possible to store this option as default somewhere?

– motam79
Sep 12 '18 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!)

– Ismael Miguel
Sep 12 '18 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
Sep 12 '18 at 10:40



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.



Thanks for contributing an answer to Super User!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)