Re: Possible to setup a SSH port forwarding only (!) in background without showing a Terminal window?



Peter Insold wrote:

Whenever I start a SSH port forwarding session with either Windows based
Putty or linux based OpenSSH an additional SSH terminal window is created
and shown.

Is there a way to created just a background port forwarding session
WITHOUT such a ssh terminal window in foreground?

Peter

With linux, you can put the command in a script file and have that run on
system startup, network startup or user login, whichever is most
appropriate.

E.g. I have something similar to the following in ~/.network-autostart and
have that set to run as part of the network startup sequence on my laptop:

#!/bin/sh

/usr/bin/ssh -L1225:localhost:25 -L1443:localhost:143 -CN mydomain.co.uk &

This connects to my server account via port forwarding on the router and
forwards ports 1225 and 1443 on the laptop to ports 25 and 143 on the
server. It is invisible to me as a user: I just set my e-mail client to use
port 1225 on the laptop to send mail and port 1443 to access the IMAP
server.


~/.network-autostop runs when the network disconnects (not unusual with
wireless) and contains

#!/bin/sh

/usr/bin/pkill -u steve ssh

This kills the ssh session and releases the local ports so that forwarding
can be set up again when the network restarts.


I don't know if anything like this can be done with Putty on Windows. If it
can, I'd be interested to hear how to do it as I'd like set up an XP laptop
the same way.


Hope this helps.
--
Steve Hayes, South Wales, UK
----Remove colours from reply address----
.



Relevant Pages