【问题标题】:ssh config file and username for cyberarkCyber​​ark 的 ssh 配置文件和用户名
【发布时间】:2021-03-29 06:12:48
【问题描述】:

我正在尝试使用指定的用户名在 .ssh/config 文件中设置主机。问题是 - 这是到cyberark主机的ssh连接。

所以 - 使用这个命令我可以连接到目标主机:

ssh user1@user2@ip1@ip2

或使用此命令 - 也可以:

ssh ip2 -l user1@user2@ip1

但是,在.ssh/config 中使用此配置时我无法连接:

Host targethost
  Hostname ip2
  User user1@user2@ip1

然后当我尝试ssh targethost 时,我遇到了连接超时。我尝试将用户名放在引号中,但这也无济于事。

有什么想法吗?

[编辑:]

ssh -Tv的输出

$ ssh -Tv ip2
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /home/user/.ssh/config
debug1: Reading configuration data /home/user/user_profile/ssh_config
debug1: /home/user/.ssh/config line 14: Applying options for ip2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to ip2 [x.x.x.x] port 22.

然后就挂了

/etc/ssh/ssh_config 来自第 58 行:

Host *
        GSSAPIAuthentication yes
        ForwardX11Trusted yes
        SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
        SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
        SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
        SendEnv XMODIFIERS

【问题讨论】:

    标签: ssh openssh ssh-config cyber-ark


    【解决方案1】:

    如果您使用正确的“用户名”条目,它应该可以通过config(如confirmed here)工作:

    Host targethost
      Hostname ip2
      User user1@user2@ip1  <====
    

    应该是User,而不是Username
    说明见“SSH Config File Example”。

    【讨论】:

    • 自我注意:这是我在 Stack Overflow 上的 第 25000 个答案(147 个月内),距离24000th answer 不到 6 个月。在此之前:23000th answer22000th answer21000th answer20000th answer19000th answer18000th answer、...
    • 对不起,我的描述有误。我的配置中确实有User。无论如何,它对我不起作用。使用用户名直接向 shell 键入 ssh 命令可以工作,但看起来不会从配置中读取此特定配置的用户名。
    • @robson 你可以试试ssh -Tv targethost 来检查 ssh 在做什么吗?
    • 请查看我的帖子更新以及 ssh -Tv 命令的输出,谢谢
    • @robson ~/.ssh/config 第 58 行的选项是什么?
    猜你喜欢
    • 2011-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多