1

We use a special ssh proxy which forces me to connect to servers using this syntax: ssh myuser@[email protected]@crappysshproxy.sub.domain. Btw: this proxy is called PSMP and belongs to the CyberArk product suite, it is not a jump or bastion host, although is seems to be similar because I do not have direct access to the servers and only the proxy is reachable.

To shorten this I tried the following ~/.ssh/config:

Host server
  HostName [email protected]@crappysshproxy.sub.domain
  User myuser

Why I then do ssh server I get ssh: Could not resolve hostname [email protected]@crappysshproxy.sub.domain: Name or service not known.

I tried to add these ...

CheckHostIP no
VerifyHostKeyDNS no

... to my ssh config and this ...

UseDNS no

... to the global ssh config.

Can I keep ssh from doing a DNS lookup and make it just use User+HostName for connections ? I am not searching for a solution that makes me create shortcut bash scripts like server.sh that does the concatenation for me and I do not want to alias / replace the ssh command.

13
  • The best solution seems an alias indeed.... Commented Feb 26, 2019 at 16:11
  • you might find better luck with ProxyJump; I haven't played with it enough to Answer.
    – Jeff Schaller
    Commented Feb 26, 2019 at 16:11
  • 1
    Does this work? HostName crappysshproxy.sub.domain and User myuser@[email protected]? I'm fairly sure ssh will split user@host on the last @, so I think that's equivalent to your ssh command-line that works.
    – filbranden
    Commented Feb 26, 2019 at 16:24
  • 1
    @filbranden This looks promising, but now I have a new problem because some calls to ssh are created with publickey -o PasswordAuthentication=no automatically and this interferes (btw: no, I can not use keys for now ;-)) with my other settings. I will check this and update my question
    – Marged
    Commented Feb 26, 2019 at 17:00
  • 1
    @filbranden I asked for all of this because Ansible spawns ssh for me. ssh server worked from the shell but Ansible adds more commands. So I had to add --ask-pass to my Ansible command line. This then worked.
    – Marged
    Commented Feb 26, 2019 at 18:09

1 Answer 1

1

When you pass ssh an user@host setting, it will split that string on the last @ and use the first part (with @s if present) as the user name.

So the equivalent way to specify that in your .ssh/config is:

Host server
  HostName crappysshproxy.sub.domain
  User myuser@[email protected]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .