SSH configuration files
SSH client configuration file
This file is usually located at:
- Linux/Unix:
/etc/ssh/ssh_config(system-wide) or~/.ssh/config(user-specific) - Windows:
C:\ProgramData\ssh\ssh_config
Common Directives:
Host: Specifies a pattern for matching host names.User: Sets the username for the SSH connection.Port: Specifies the port number to connect to on the remote host.IdentityFile: Specifies the file from which the user's private key is read.
Sample ssh_config
# Default SSH options
Host how_i_would_identify_the_server
User your_username
Port 22
IdentityFile ~/.ssh/id_rsa
SSH daemon configuration file
This file is usually located at:
- Linux/Unix:
/etc/ssh/sshd_config - Windows:
C:\ProgramData\ssh\sshd_config
Common Directives:
Port: Specifies the port number for the SSH daemon.ListenAddress: Sets the IP addresses that the SSH server listens on.PermitRootLogin: Controls whether the root user can log in directly.PasswordAuthentication: Enables or disables password authentication.PubkeyAuthentication: Enables or disables public key authentication.AllowUsers: Restricts which users can log in.
Sample sshd_config
# Port to listen on
Port 22
# Allow root login
PermitRootLogin no
# Use public key authentication
PubkeyAuthentication yes
# Allow specific users
AllowUsers user1 user2