1

We use a special ssh proxy which forces me to connect to servers using this syntax: ssh myuser@privilegeduser@server.sub.domain@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 privilegeduser@server.sub.domain@crappysshproxy.sub.domain
  User myuser

Why I then do ssh server I get ssh: Could not resolve hostname privilegeduser@server.sub.domain@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.

  • The best solution seems an alias indeed.... – Rui F Ribeiro Feb 26 at 16:11
  • you might find better luck with ProxyJump; I haven't played with it enough to Answer. – Jeff Schaller Feb 26 at 16:11
  • 1
    Does this work? HostName crappysshproxy.sub.domain and User myuser@privilegeduser@server.sub.domain? 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 Feb 26 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 Feb 26 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 Feb 26 at 18:09
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@privilegeduser@server.sub.domain

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.