我在一个域下有一堆我经常连接的机器;
apollo.my.university.edu hades.my.university.edu zeus.my.university.edu
我对它们中的每一个都使用相同的配置设置。而不是在我的.ssh/config,
Host apollo
Hostname apollo.my.university.edu
Host hades
Hostname hades.my.university.edu
Host zeus
Hostname zeus.my.university.edu
Run Code Online (Sandbox Code Playgroud)
是否有一种 makefile-esque 方式使用别名同时完成所有主机名?就像是
Host apollo hades zeus
Hostname *.my.university.edu
Run Code Online (Sandbox Code Playgroud)
尝试
Host apollo hades zeus
Hostname %h.my.university.edu
Run Code Online (Sandbox Code Playgroud)
如果我man ssh_config正确阅读,这应该可以满足您的需求。
HostName
Specifies the real host name to log into. This can be used to specify nicknames
or abbreviations for hosts. If the hostname contains the character sequence
`%h', then this will be replaced with the host name specified on the command
line (this is useful for manipulating unqualified names). The default is the
name given on the command line. Numeric IP addresses are also permitted (both
on the command line and in HostName specifications).
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
733 次 |
| 最近记录: |