0

I need to use SSH over SSH without confirmation in two hosts or at lease without confirmation on the second host.

Expected behavior:

ssh -t -o 'StrictHostKeyChecking no' user@machineB ssh -o 'StrictHostKeyChecking no' user@machineA

Currently working only:

ssh -t -o 'StrictHostKeyChecking no' user@machineB ssh user@machineA
grooveplex
  • 2,486
goldver
  • 101
  • 2
  • 1
  • Hello! What actually you want to achieve? Probably creating ssh tunnel will be more elegant solution. Please check this topic: Access remote multiple servers behind NAT. A secure way to log-in into a ssh server without conformation is to use ssh key based authentication and a key with empty passphrase. – pa4080 Dec 18 '18 at 14:08
  • As I read the question again, I think the duplicate does not really fit. Is the Host key always changing on your server? Otherwise, you have to confirm only once, or put the key manually to the known_hosts file, then you don't need to confirm anything. I would not turn off that security feature. – pLumo Dec 18 '18 at 14:49
  • 1
    this is my solution:
     ssh -t -o 'StrictHostKeyChecking no' 10.10.x1.x -A "ssh-keyscan 10.10.x2.x &>/dev/null && ssh -q -o 'StrictHostKeyChecking no'10.10.x2.x ls -la"
    
    

    by ssh-keyscan I can reach another host without confirmation

    – goldver Dec 21 '18 at 11:09

1 Answers1

0

Try using quotes for everything after the first ssh command:

ssh -t -o 'StrictHostKeyChecking no' user@machineB "ssh -o 'StrictHostKeyChecking no' user@machineA"

I'm not sure as to your purpose with the -t flag, it is not mentioned in the docs. If you need it for the first ssh command, then you probably need it for the second ssh as well, so, if the above doesn't work, try either of these:

Both -t :

ssh -t -o 'StrictHostKeyChecking no' user@machineB "ssh -t -o 'StrictHostKeyChecking no' user@machineA"

Neither -t :

ssh -o 'StrictHostKeyChecking no' user@machineB "ssh -o 'StrictHostKeyChecking no' user@machineA"
Jesse
  • 140