OpenSSH Config File Examples For Linux / Unix Users

OpenSSH Config File Examples For Linux / Unix Users

The OpenSSH configuration file, ssh_config, is used to set options for the ssh client. The ssh_config file is located in the /etc/ssh directory on most systems.

Here are some examples of common options that can be set in the ssh_config file:

  • Host: This option specifies a hostname or a pattern to match multiple hostnames. For example, you can use the Host option to specify a hostname or an IP address for a remote server that you want to connect to:
refer‮ttual:ot ‬uri.com
Host example.com
Host 192.168.1.100

You can also use wildcards to match multiple hostnames:

Host *.example.com
  • Port: This option specifies the port number to use for the connection. By default, ssh uses port 22 for the connection. You can use the Port option to specify a different port number:
Port 2222
  • User: This option specifies the username to use for the connection. You can use the User option to specify a different username than the one you are currently logged in as:
User myuser
  • IdentityFile: This option specifies the path to a private key file to use for authentication. You can use the IdentityFile option to specify the path to a private key file that you want to use for the connection:
IdentityFile ~/.ssh/id_rsa
  • ForwardAgent: This option specifies whether to forward the ssh-agent connection to the remote server. You can use the ForwardAgent option to enable or disable agent forwarding:
ForwardAgent yes
  • ForwardX11: This option specifies whether to forward X11 connections to the remote server. You can use the ForwardX11 option to enable or disable X11 forwarding:
ForwardX11 yes
  • Compression: This option specifies whether to enable compression for the connection. You can use the Compression option to enable or disable compression:
Compression yes
  • ServerAliveInterval: This option specifies the interval in seconds to send a null packet to keep the connection alive. You can use the ServerAliveInterval option to specify the interval in seconds:
Created Time:2017-10-16 14:38:54  Author:lautturi