/etc/ssh
The /etc/ssh/
directory on Linux systems typically contains configuration files and key-related files for the OpenSSH (Secure Shell) protocol suite. This directory plays a crucial role in managing SSH server configurations, host keys, and related settings.
Overview of /etc/ssh/
/etc/ssh/
Purpose
The /etc/ssh/
directory serves the following purposes:
SSH Server Configuration: Contains configuration files (
ssh_config
andsshd_config
) that define behavior and settings for both SSH clients and the SSH daemon (server).Host Keys: Stores host keys used for server authentication. These keys include
ssh_host_rsa_key
,ssh_host_dsa_key
,ssh_host_ecdsa_key
,ssh_host_ed25519_key
, which are generated during SSH server installation.Moduli: Contains Diffie-Hellman moduli used for DH key exchange. Files like
moduli
store prime numbers used in the DH group exchange algorithms.SSH Client Configuration: Although primarily focused on server configuration, this directory may also contain client configuration files if not individually managed in user directories (
~/.ssh/
).
Key Files and Directories
ssh_config
: Configuration file for SSH client options. It defines client-side settings such as hostname resolution, user authentication, and connection parameters.sshd_config
: Configuration file for the SSH daemon (server). It specifies server-side settings including authentication methods, access controls, and SSH protocol options.Host Keys:
ssh_host_rsa_key
,ssh_host_rsa_key.pub
: RSA host keys.ssh_host_dsa_key
,ssh_host_dsa_key.pub
: DSA host keys (less common now due to security concerns).ssh_host_ecdsa_key
,ssh_host_ecdsa_key.pub
: ECDSA host keys.ssh_host_ed25519_key
,ssh_host_ed25519_key.pub
: Ed25519 host keys (modern and recommended).
moduli
: File containing Diffie-Hellman moduli for DH key exchange algorithms used by SSH.ssh_known_hosts
: File containing public host keys for known hosts. It stores keys of SSH servers that the client has connected to previously.
Example Configuration Files
/etc/ssh/sshd_config
/etc/ssh/sshd_config
/etc/ssh/ssh_config
/etc/ssh/ssh_config
Managing SSH Configuration
Editing Configuration Files: Modify
sshd_config
andssh_config
as needed to adjust SSH server and client behavior respectively.Restarting SSH Service: After making changes to
sshd_config
, restart the SSH service for changes to take effect:Securing Host Keys: Ensure proper permissions (
600
for private keys,644
for public keys) and periodically regenerate host keys for enhanced security.
Conclusion
The /etc/ssh/
directory is critical for configuring and managing SSH on Linux systems. It houses essential configuration files, host keys, and moduli used for secure communication between clients and servers. Proper configuration and management of this directory are crucial for maintaining secure and efficient SSH connections.
Last updated