Ubuntu SSH Configuration File Locations

This article provides a quick and direct guide to locating the default Secure Shell (SSH) configuration files on Ubuntu Linux. You will learn the exact directory paths for both the SSH client and server (daemon) configurations, as well as where user-specific SSH settings are stored.

The SSH Server Configuration File (sshd)

If you are running an SSH server on Ubuntu to allow incoming connections, the primary configuration file is the sshd_config file. This file controls server-specific settings such as the listening port, root login permissions, and authentication methods.

To edit this file, you must use superuser privileges:

sudo nano /etc/ssh/sshd_config

After making changes to this file, you must restart the SSH service to apply them:

sudo systemctl restart ssh

The SSH Client Configuration Files (ssh)

SSH client configurations dictate how your local Ubuntu system behaves when connecting to remote SSH servers.

1. System-Wide Client Configuration

The system-wide configuration applies to all users on the Ubuntu system who initiate outgoing SSH connections.

2. User-Specific Client Configuration

Individual users can override system-wide settings by creating or editing a configuration file within their home directory. This file is highly useful for defining custom hosts, ports, and private keys for specific remote servers.

Key and Authorized User Files

In addition to the main configuration files, Ubuntu stores SSH keys and authorized access files in specific directories: