我使用ssh -t ⟨AD user⟩@⟨gateway IP⟩ ssh ⟨destination hostname⟩
连接到⟨destination hostname⟩
。网关要求提供 Active Directory 凭据,然后让我登录到⟨destination⟩
。
我正在尝试将此配置保存到~/.ssh/config
。我最后一次尝试是
Host ⟨gateway⟩
HostName ⟨gateway IP⟩
RequestTTY force
User ⟨AD user⟩
Host ⟨destination⟩
HostName ⟨destination hostname⟩
ProxyJump ⟨gateway⟩
User ⟨AD user⟩
不是⟨destination hostname⟩
IP,而是网关查找的名称。这个东西似乎工作正常。一个失败点似乎是我的本地计算机用户名⟨local user⟩
不同于,但 SSH在远程计算机中⟨AD user⟩
查找 ID 文件和而不是。我曾尝试在 SSH 配置中明确设置,但没有成功。known_hosts
/home/⟨local user⟩/
/home/⟨AD user⟩/
IdentityFile
因此,鉴于此 LDAP 网关设置,您是否知道我是否可以进行调整,~/.ssh/config
以便可以使用登录到远程机器ssh ⟨destination⟩
?
如果您确实需要在远程网关机器上执行
ssh
命令(而不是通过网关机器建立隧道连接),那么使用指令:RemoteCommand
参见https://man.openbsd.org/ssh_config#RemoteCommand
这是我在 .ssh/config 中已经存在一段时间的东西。它允许您执行诸如 之类的操作
ssh gateway1+gateway2+gateway3+target
,并且它会以菊花链方式连接。每个项目(如您所料)的形式都是[user@]hostname[:port]
。您可以添加
-t
命令以让其沿途分配 TTY。我承认,我并没有像我想象的那样经常使用它。