The Go Blog

ssh_config file use Include

bantana
10 May 2019

structure

$ cat ~/.ssh/config

Include ~/.ssh/config.d/*.config

$ tree ~/.ssh/config.d/

$HOME/.ssh/config.d/
├── company.config
├── private.config
└── shdockers.config

0 directories, 3 files

host configuration

# aliyun us_a
Host changeHostName
  Hostname 192.168.1.235
  port 22
  User yourUserName
  IdentityFile ~/.ssh/id_rsa

Host JumpHostName
  Hostname xxx.xxx.xxx.xxx
  port 22
  User yourUserName
  IdentityFile ~/.ssh/id_rsa

Host innerHostName
  ProxyCommand ssh -W %h:%p JumpHostName 2> /dev/null
  Hostname 192.168.8.8
  Port 22
  User yourUserName
  IdentityFile ~/.ssh/id_rsa

reference

man 5 ssh_config
man ssh

Related articles