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.
- Default Path:
/etc/ssh/sshd_config - Default Directory:
/etc/ssh/
To edit this file, you must use superuser privileges:
sudo nano /etc/ssh/sshd_configAfter making changes to this file, you must restart the SSH service to apply them:
sudo systemctl restart sshThe 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.
- Default Path:
/etc/ssh/ssh_config
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.
- Default Path:
~/.ssh/config(or/home/username/.ssh/config)
Key and Authorized User Files
In addition to the main configuration files, Ubuntu stores SSH keys and authorized access files in specific directories:
- Authorized Public Keys:
/home/username/.ssh/authorized_keys(Stores the public keys of clients allowed to log into this user account). - User Private/Public Key Pairs:
/home/username/.ssh/id_rsaand/home/username/.ssh/id_rsa.pub(Default names for generated SSH keys). - System Host Keys:
/etc/ssh/ssh_host_*_key(Used by the SSH daemon to identify the server to clients).