Bill
Bill

Reputation: 2973

Merge ssh config

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.

Upvotes: 0

Views: 267

Answers (1)

mariolu
mariolu

Reputation: 700

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

Upvotes: 1

Related Questions