Last active
March 26, 2022 02:55
-
-
Save SomajitDey/3c37c89f8619be8d48d4fc78b5f90a71 to your computer and use it in GitHub Desktop.
How to alias user@hostname:port for SSH. As a .conf file inside /etc/ssh_config.d directory
This file contains 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
# NOTE: You may simply put this config file inside /etc/ssh_config.d directory. | |
# Ref : https://www.howtogeek.com/75007/stupid-geek-tricks-use-your-ssh-config-file-to-create-aliases-for-hosts/ | |
# To create ssh-keys easily use `ssh-keygen` @client followed by `ssh-copy-id server` | |
Host <alias> | |
User <uid> | |
HostName <ip or hostname> | |
Port <port> | |
IdentityFile <~/.ssh/your_saved_key> # for passwordless login | |
ServerAliveInterval 120 | |
ServerAliveCountMax 30 | |
# The above keepalive will refresh every 2 minutes for a maximum of 30 consecutive times. | |
# That means, it will stop refreshing after an hour | |
# Change values to your suiting | |
Host <next_alias> | |
... | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment