Re: Creating dynamic tunnels using bash script (cygwin/solaris)



galmok@xxxxxxxxx wrote:
I am trying to create a tunnel via ssh from cygwin to solaris. Normally
I would do something like this (cygwin is my windows box having cygwin
installed and solaris is a solaris based server):

cygwin$ ssh -L5900:localhost:5900 solaris

My problem is that the destination port is unknown at the time I create
the ssh call. Only once I have logged in on solaris can I determine the
destination port. So I was thinking why not use the "~" escape code to
create a tunnel on the fly. The ssh connection is created in a shell
and therefore not used interactively.

So I would do something like this:

(send_commands) | ssh -t -t solaris | (parse_output)

Two problems arise now:

1) Using "-t -t" to force tty allocation prevents anything sent to
stdout/stderr on solaris to be trasmitted to my cygwin box.

2) Sending the escape code "~C" somehow makes ssh grab keyboard input
even though it is placed after a pipe (|), i.e. stdin was supposed to
come from send_commands yet ssh managed to grab keyboard input. I was
quite surprised that this was possible and have still not solved that
puzzle.

Of course, both problems are a showstopper. I dont know why ssh stops
listening to stdin once an escape command is requested "~C" and I am
also at a loss as to why solaris refuses to send any tty output back
via the ssh connection.

Does anyone out there have a suggestion/solution?


Not sure I see what the problem here is or why it needs to be
complicated. I use ssh to forward VNC connections all the time. I just
forward port 590x to the remote server same port and connect the viewer
to the localhost port. It's that simple. The only other thing you may
need to do is enable the option on the server that allows connections
from localhost.
.



Relevant Pages

  • Re: possible problem with scp/ssh/telnet
    ... (sshd on the Linux side), which actually listens on port 22. ... SSH should be running as a service under Windows; ... As for configuration, from within a Cygwin shell, go to /etc and look at ...
    (Fedora)
  • Intermittent SSH failures from Cygwin
    ... I've hit a problem that only seems to occur when doing SSH from Cygwin ... I have a script that makes several connections from Cygwin to Solaris ... OpenSSL 0.9.7b 10 Apr 2003 ...
    (comp.security.ssh)
  • Creating dynamic tunnels using bash script (cygwin/solaris)
    ... I am trying to create a tunnel via ssh from cygwin to solaris. ...
    (comp.security.ssh)
  • server securing issues
    ... have done some securing on my solaris server and ... Information about the remote host: ... Port ssh ... An SSH server is running on this port. ...
    (SunManagers)
  • Re: Creating dynamic tunnels using bash script (cygwin/solaris)
    ... I would do something like this (cygwin is my windows box having cygwin ... installed and solaris is a solaris based server): ... My problem is that the destination port is unknown at the time I create ... the ssh call. ...
    (comp.security.ssh)