0
votes

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.

1

1 Answers

0
votes

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