Discussion:
Manipulating Forwards on an existing shell
(too old to reply)
Quintin Beukes
2009-10-19 20:01:04 UTC
Permalink
Hey,

Is there any way at all to manipulate local forwards on an existing
shell? I basically have a script which I run to setup a bunch of port
forwards to create a pseudo-VPN. It's much stabler through SSH than it
is through our PPTP VPN. So it would be nice to create a zenity script
to setup instant forwards without having to first close SSH and reopen
it. To establish the connection takes quite long due to the
authentication, where creating a new forward is almost instantaneous.
Further I will also not loose my existing connections.

My SSH version: OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007

It doesn't really matter if the only way to do it is dirty, because
I'm not really aiming at portability. It's mostly only for me to use
on my home machines.

Quintin Beukes
Darren Tucker
2009-10-20 02:11:58 UTC
Permalink
Post by Quintin Beukes
Is there any way at all to manipulate local forwards on an existing
shell?
Use the ~C escape, which is documented in ssh(1) thusly:

~C Open command line. Currently this allows the addition of port
forwardings using the -L, -R and -D options (see above). It also
allows the cancellation of existing remote port-forwardings using
-KR[bind_address:]port. !command allows the user to execute a
local command if the PermitLocalCommand option is enabled in
ssh_config(5). Basic help is available, using the -h option.

Depending on what you're doing, you may be better served by
-D/DynamicForward which allows you to use SOCKSified clients rather than
created new (local) forwards for each purpose.
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
Quintin Beukes
2009-10-20 07:53:46 UTC
Permalink
I know -D (socks) and ~C (then -Lx:y:z), which is what I use
currently. And I have to use normal port forwards.

What I'm looking for is to make this easier with a zenity dialog at
the click of a button, then have to terminal pipe somewhere and become
a background process.

Is there perhaps some options I can supply to SSH so it accepts ~C
(then the options + \n) from stdin?

Quintin Beukes
Post by Quintin Beukes
Is there any way at all to manipulate local forwards on an existing
shell?
 ~C   Open command line.  Currently this allows the addition of port
     forwardings using the -L, -R and -D options (see above).  It also
     allows the cancellation of existing remote port-forwardings using
     -KR[bind_address:]port.  !command allows the user to execute a
     local command if the PermitLocalCommand option is enabled in
     ssh_config(5).  Basic help is available, using the -h option.
Depending on what you're doing, you may be better served by
-D/DynamicForward which allows you to use SOCKSified clients rather than
created new (local) forwards for each purpose.
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
   Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
Loading...