Last active
July 9, 2025 21:41
-
-
Save chales/5448026 to your computer and use it in GitHub Desktop.
SSH Config - Sample file to show staff the common options to add to your '~/.ssh/config' file. This is just a text file and should have the same perms as the other files in ~/.ssh, usually 600 (read and write by user only).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Example SSH config file | |
| # Host = a list of domains, IPs and aliases that use this config entry. | |
| # e.g. Host 192.168.1.1 exp1 | |
| # Hostname = the IP or real hostname | |
| # e.g. Hostname 192.168.1.1 | |
| # User = the username | |
| # e.g. User jdoe | |
| # Port = if this is a non standard port, i.e. not 22 | |
| # e.g. Port 2345 | |
| # The above would allow you to use: ssh exp1 | |
| # which is now equivalent to: ssh jdoe@192.168.1.1 -p2345 | |
| # ssh jdoe | |
| #### Examples | |
| # Example 1 | |
| Host 192.168.1.1 example1 | |
| Hostname 192.168.1.1 | |
| # Non standard port | |
| Port 2222 | |
| # Enable forwarding | |
| ForwardAgent yes | |
| # Proxy forwarding of the connection via 192.168.1.4 | |
| ProxyCommand ssh jdoe@192.168.1.3 nc %h %p 2> /dev/null | |
| # Example 2 | |
| Host 192.168.1.2 example2 | |
| Hostname 192.168.1.2 | |
| # Enable forwarding | |
| ForwardAgent yes | |
| ###################################### | |
| #### defaults / catchall | |
| Host * | |
| User jdoe | |
| IdentityFile ~/.ssh/id_rsa | |
| # Enable compression | |
| Compression yes | |
| # Hash known-host names | |
| HashKnownHosts yes | |
| # Keep connection alive | |
| ServerAliveInterval 15 | |
| ServerAliveCountMax 3 | |
| # Forward agent | |
| # ForwardAgent yes | |
| # Allow local and proxy commands | |
| PermitLocalCommand yes | |
| # Multiplexing shared connections to improve speed | |
| ControlPath ~/.ssh/master-%l-%r@%h:%p | |
| ControlMaster auto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment