4

When I ssh to another host hosta and then connect yet to a further host hostb, everything works fine. Both hosts currently expect a passwd.

However, when I try to shortcut this intermediate host and put the next ssh as a parameter, I get the often mentioned error:

$ ssh -X hosta ssh1 -X -1 login@hostb
Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied.

All this seems to be related to the environment variables that are passed further on.

What is ssh here expecting? How can I fix this?

And, I have already added hostb to the known hosts on hosta.

false
  • 1,762

2 Answers2

3

According to man ssh:

 -t      Force pseudo-terminal allocation.  This can be used to execute
         arbitrary screen-based programs on a remote machine, which can be
         very useful, e.g. when implementing menu services.  Multiple -t
         options force tty allocation, even if ssh has no local tty.

Since you are running multiple ssh sessions you would use multiple -t's. They can be shortened by doing ssh -tt. The command then would look like the following to force a pseudo-tty so you can enter passwords and see prompts on your connections.

ssh -tt -X hosta ssh1 -X -1 login@hostb

Hope this helps!

Terrance
  • 43,712
1

Kind-of-a-solution:

Instead of executing the remote command directly, I added a xterm -e in front. In this manner it seems the right variables are here, and also the second prompt works.

false
  • 1,762