ssh config file and username for cyberark

1.8k views Asked by At

I'm trying to setup host in .ssh/config file with specified username. The problem is - this is ssh connection to cyberark host.

so - with this command I can connect to the target host:

ssh user1@user2@ip1@ip2

or with this command - works as well:

ssh ip2 -l user1@user2@ip1

but, I cannot connect when using this configuration in .ssh/config :

Host targethost
  Hostname ip2
  User user1@user2@ip1

Then when I try ssh targethost, I have connection timeout. I tried to put username into quotes, but this didn't help as well.

Any idea?

[EDIT:]

Output of 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.

And then it is hanging

/etc/ssh/ssh_config from line 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
1

There are 1 answers

11
VonC On

It should work through config (as confirmed here), provided you use the right entry for "username":

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

It should be User, not Username.
See "SSH Config File Example" for illustration.