Last active
August 29, 2015 14:05
-
-
Save thecodesmith/d6863480f4d2f9b7071f to your computer and use it in GitHub Desktop.
Basic SSH config file and usage
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
| # Notes: | |
| # Port field not required, defaults to 22 | |
| # IdentityFile field not required, defaults to ~/.ssh/id_rsa | |
| Host github | |
| User git | |
| HostName github.com | |
| IdentityFile ~/.ssh/id_rsa | |
| Host laptop | |
| HostName 192.168.0.200 | |
| User thecodesmith | |
| Port 22 | |
| IdentityFile ~/.ssh/id_rsa | |
| # Port-forwarding example | |
| Host tunnel | |
| HostName database.example.com | |
| IdentityFile ~/.ssh/thecodesmith.example.key | |
| LocalForward 9906 127.0.0.1:3306 | |
| User thecodesmith |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage from console:
With git:
With ssh:
Local port-forwarding:
Port-forwarding this way allows pointing to localhost:9906 which will forward to remote (example.com) port 3306. This example taken from http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/