On Thu (15/11/12), Alexander Hall wrote:
> On 11/15/12 23:10, Manolis Tzanidakis wrote:
> >Hello all,
> >I want to send the '~C' escape to ssh followed by ie. '-L 
> >1024:localhost:1024'
> >from the active ssh connection's shell, non-interactively from a script.
> >Is it possible? Or is there a better way to accomplish this?
> 
> Without judging the reason, `ssh -t` might be a good start.

Hey there,
thanks for answering. Could you be more specific pls? I'm not sure how
this could help. All users will have regular logins (pseudo-ttys) and
can send escape sequences to ssh.
> 
> >I'm trying to build an idiot-proof menu for non tech savvy users to allow 
> >them
> >create a couple of tunnels to local services (on different ports), on demand.
> >The script needs to run a bunch of other stuff after adding the tunnels, so I
> >can't just tell them to pass '-L etc.' to the client..

Let me rephrase this to avoid further misunderstandings. I've got this
scenario (anything prior to '$' is the hostname):

userbox$ ssh u...@foo.bar
foo.bar$ printf "%s@%s\n" "`whoami`" "`hostname`"
u...@foo.bar

Let's say the user wants to add a tunnel to her current ssh connection
for accessing httpd running on server foo.bar. The httpd listens on
localhost only.
I want to automate this process:

foo.bar$ ~C
ssh> -L 2000:localhost:80
Forwarding port.

-- 
Manolis Tzanidakis
http://mtzanidakis.com/
mtzanidakis[at]gmail[dot]com

Reply via email to