Can one use the output of a command/script in an ssh_config 'match'?

Chris Green cl at isbd.net
Sun Nov 8 23:15:57 AEDT 2026


I have a script which generates a list of hosts, it's used in various
places on my LAN systems for configuration management and such.

It would be very handy if I could use its output in a match in my
~/.ssh/config file.  I.e. I would like to be able to do something like:-

    Match host $(listofhosts) exec <bla bla bla>
       <set something>
       <set something else>

where '$(listofhosts)' inserts the output of listofhosts in the Match line.

Is there any way of doing something like this?  I've looked through the
ssh_config man page quite carefully and I don't see anything, but
(hopefully) maybe I'm missing something.

-- 
Chris Green


More information about the openssh-unix-dev mailing list