0

Is there a way to merge the ssh config file into one session?

Such as

$ vim ~/.ssh/config

Host sshtest1
    HostName 192.168.1.11
    User ec2-user

Host ssttest2
    HostName 192.168.1.12
    User ec2-user

into

Host sshtest?
    HostName 192.168.1.1?
    User ec2-user

I did a try, but got this error:

ssh: Could not resolve hostname 192.168.1.1?: nodename nor servname provided, or not known

Suppose I have 9 nodes. I don't want to repeat that sessions.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Bill
  • 2,494
  • 5
  • 26
  • 61

1 Answers1

1

You can merge common line like this:

Host sshtest1
    HostName 192.168.1.11

Host ssttest2
    HostName 192.168.1.12

Host *
    User ec2-user
mariolu
  • 624
  • 8
  • 17