top | item 41171579

(no title)

malikNF | 1 year ago

>No need to remember server IPs

On your local machine under ~/.ssh/config you can add something like

#PERSONAL

Host vpn-us

    HostName 1.2.3.4

    User my_fun_username

    Port 1212

now you can ssh using

ssh vpn-us

(above is the same as the following command --> ssh my_fun_username@1.2.3.4 -p1212)

discuss

order

adolph|1 year ago

Also you can organize servers into different config files and Include them your base config,.

  $ cat .ssh/config
  # Fictitious example
  Include work.config
  Include personal.config
  $ 
https://man7.org/linux/man-pages/man5/ssh_config.5.html

malikNF|1 year ago

This looks very useful. I did not know this. Thank you!

zamadatix|1 year ago

One thing I wish ~/.ssh/config had was more slightly powerful matching. I think all you get for dynamic matches is * and ? instead of a regex syntax. Works probably 99% of the time.