【发布时间】:2021-12-31 05:52:50
【问题描述】:
编辑:我看到过这种方法有效的情况和无效的情况,我不确定我何时/为什么这样做。
假设我有一个足够复杂的条目,我在其中指定多个参数以获取thathost:
Host thathost
ControlMaster auto
ServerAliveInterval 8
ConnectTimeout 8
Hostname 192.168.5.1
User mememe
ProxyJump thejumpbox
我想通过添加或覆盖某些配置来重新使用此定义来创建提供不同功能的附加条目。专门指定一个备用端口(不,我不想在命令行上使用它)。
理想情况下,我可以做类似的事情
Host theirhost
Hostname thathost
User themthem
或
Host my-remote-serialport
Hostname thathost
RequestTTY yes
RemoteCommand some-script-that-launches-kermit-on-a-specific-dev-tty
或
Host my-remote-serialport
Hostname thathost
Port 3004
我只希望根据另一个现有主机指定一个主机,我不想修改我的 Host 条目以匹配某些模式“技巧”。
显然我可以使用ProxyCommand ssh -q nc thathost... 或ProxyJump thathost +Hostname localhost,然后是所有其他覆盖(端口覆盖将传递给nc)但这既丑陋又浪费(额外的会话)-请不要这样回答。
对我来说,这是ssh-config 的缺少的功能,但也许我看起来不够努力。
【问题讨论】:
标签: ssh openssh ssh-config