Last Updated: February 25, 2016
·
17.58K
· danielpuglisi

Exclude hosts in ssh config

To exclude specific hosts or IP-ranges from a specific ssh configuration, you can simple add an ! before the hostname.

Example

Host * !notthisone.com !192.168.0.? !*.local
  # config goes here

This configurations matches all hosts except notthisone.com, all hosts in 192.168.0.0/24 and all hosts with the .local TLD.