0

in my ~/.ssh/config I would like to define something like this

# myvm.hosting.com is a real existing domain
Host myvm.hosting.com
  # tunnel to mysql
  LocalForward 3311 localhost:3306

# example.com is a real existing domain
Host example.com
  User myuser
  HostName myvm.hosting.com

# example.org is a real existing domain
Host example.org
  User myuser
  HostName myvm.hosting.com

When I run ssh example.com I would like to execute the port forwarding defined for the myvm.hosting.com, but it looks like HostName is not overriding Host...

Ho to achive this?

PS:

  • Host * is not an option cause I have many "base machines" like myvm.hosting.com
  • I would like to keep using real DNS, I don't want niknames

Thanks!

1 Answer 1

0

Settings before the first host apply to all connections

  LocalForward 3311 localhost:3306

# myvm.hosting.com is a real existing domain
Host myvm.hosting.com
  # tunnel to mysql

# example.com is a real existing domain
Host example.com
  User myuser
  HostName myvm.hosting.com

# example.org is a real existing domain
Host example.org
  User myuser
  HostName myvm.hosting.com
1
  • Thanks, but I want to set different ports for different "base machines"
    – nulll
    Jun 22, 2018 at 12:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .