0

我的 .ssh/配置:

Host *.gnu.org
  Compression yes 

Host bixeon
  User root
  ProxyCommand ssh newton nc -w 1 %h 22

Host freebsd.polarhome.com freebsd
  Port 715
  Protocol 2,1
  Hostname gate.polarhome.com

Host solaris.polarhome.com solaris
  Port 725
  Protocol 2,1
  Hostname gate.polarhome.com

Host openbsd.polarhome.com openbsd
  Port 735
  Protocol 2,1
  Hostname gate.polarhome.com

Host netbsd.polarhome.com netbsd
  Port 745  
  Protocol 2,1
  Hostname gate.polarhome.com

Host debian.polarhome.com debian
  Port 755
  Protocol 2,1
  Hostname gate.polarhome.com

Host alpha.polarhome.com alpha
  Port 765
  Protocol 2,1
  Hostname gate.polarhome.com

Host aix.polarhome.com aix
  Port 775
  Protocol 2,1
  Hostname gate.polarhome.com

Host hpux.polarhome.com hpux
  Port 785
  Protocol 2,1
  Hostname gate.polarhome.com

Host redhat.polarhome.com redhat
  Port 795
  Protocol 2,1
  Hostname gate.polarhome.com

Host ultrix.polarhome.com ultrix
  Port 805
  Protocol 2,1
  Hostname gate.polarhome.com

Host qnx.polarhome.com qnx
  Port 815
  Protocol 2,1
  Hostname gate.polarhome.com

Host irix.polarhome.com irix
  Port 825
  Protocol 2,1
  Hostname gate.polarhome.com

Host tru64.polarhome.com tru64
  Port 835
  Protocol 2,1
  Hostname gate.polarhome.com

Host openindiana.polarhome.com openindiana
  Port 845
  Protocol 2,1
  Hostname gate.polarhome.com

Host suse.polarhome.com suse
  Port 855
  Protocol 2,1
  Hostname gate.polarhome.com

Host openstep.polarhome.com openstep
  Port 865
  Protocol 2,1
  Hostname gate.polarhome.com

Host mandriva.polarhome.com mandriva
  Port 875
  Protocol 2,1
  Hostname gate.polarhome.com

Host ubuntu.polarhome.com ubuntu
  Port 885
  Protocol 2,1
  Hostname gate.polarhome.com

Host scosysv.polarhome.com scosysv
  Port 895
  Protocol 2,1
  Hostname gate.polarhome.com

Host unixware.polarhome.com unixware
  Port 905
  Protocol 2,1
  Hostname gate.polarhome.com

Host unknown1.polarhome.com unknown1
  Port 915
  Protocol 2,1
  Hostname gate.polarhome.com

Host centos.polarhome.com centos
  Port 925
  Protocol 2,1
  Hostname gate.polarhome.com

Host miros.polarhome.com miros
  Port 935
  Protocol 2,1
  Hostname gate.polarhome.com

Host hurd.polarhome.com hurd
  Port 945
  # Hurd fails with compression
  Compression no
  Protocol 2,1
  Hostname gate.polarhome.com

我有一种感觉,它可以写得更短。如何?

4

1 回答 1

3

虽然我喜欢速记主机名方法,但我发现使用速记“域”来更好地控制哪些东西适用于何处是值得的。此外,正如手册页所建议的那样,将特定于主机的内容放在前面,以覆盖您最后想要的更通用的默认值。我添加了一个虚拟条目来说明我的意思(例如,虚拟必须通过不同的主机名或使用与默认值不同的用户或身份)。

Host freebsd.polarhome.com freebsd.ph
  Port 715

Host solaris.polarhome.com solaris.ph
  Port 725

...

Host dummy.polarhome.com dummy.ph
  Hostname dummy.polarhome.com
...

Host *.polarhome.com *.ph
  Protocol 2,1
  Hostname gate.polarhome.com
于 2013-04-06T14:24:59.503 回答