« Back to SSH client configuration

SSH configuration files

For the SSH client there are typically two places where configuration files are stored: in the home directory of the user and a global configuration file.

User configuration

  • Location: ~/.ssh/config

This file is stored in the home directory of an user. It is optional and by default no file is available.

System-wide configuration

  • Location: /etc/ssh/ssh_config
  • Overrides via: /etc/ssh/ssh_config.d/*.conf

The default settings are in the ssh_config file. The system administrator may add customizations to this file, but typically it is advised to override settings using a separate configuration file. This way settings are not being overwritten by accident when a new package is released.

Order of precedence

The SSH client has a defined order of precedence when it comes to evaluating settings.

  1. Command-line options
  2. Configuration file of user
  3. Configuration file of system

Options defined on the command-line will have the highest priority and therefore override settings in configuration files. The user configuration will override the settings in the system-wide configuration.


Small picture of Michael Boelen

This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

Mastodon icon