Re: how to get the PID of an SSH tunnel
From: Darren Tucker (dtucker_at_dodgy.net.au)
Date: 03/05/04
- Next message: Darren Tucker: "Re: ssh tunnel, windowless-- possible in puTTY?"
- Previous message: all mail refused: "Re: how to get the PID of an SSH tunnel"
- In reply to: Noah: "Re: how to get the PID of an SSH tunnel"
- Next in thread: Pierre Asselin: "Re: how to get the PID of an SSH tunnel"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 4 Mar 2004 23:40:27 +0000 (UTC)
In article <c9d82136.0403041335.68d710cb@posting.google.com>,
Noah <noah@noah.org> wrote:
>pa@invalid.invalid (Pierre Asselin) wrote in message news:<3ne32c.e9s.ln@brick.verano.sba.ca.us>...
>> Noah <noah@noah.org> wrote:
>> > I'm creating an SSH tunnel using a command like this:
>> > ssh -C -n -L 25:example.com:25 -L 110:example.com:110 \
>> > my_name@example.com -f nothing_script.sh
>> The shell variable $! contains the pid of the most recently executed
>> background command. If you leave out the -f and background the ssh
>> yourself, the $! will have what you want. (You can also use -N
>> instead of an empty script.)
>
>The problem is that SSH does a fork/exec, so the pid is not what the shell sees
>as the SSH command it started (that is, $! doesn't work).
>The -N argument implies -f. You cannot leave off the -f and
>put it into the background youself because then you cannot
>enter the password. With -f or -N SSH will ask you for your password
>before it daemonizes itself. In other words, if you try to do this:
> ssh -C -n -L 110:example.com:110 my_name@example.com nothing_script.sh &
>Then I will see SSH ask me for a password, but there is no way to enter it.
>And, no, I am not allowed to use public key authentication :-P
>Finally, I'm forced to talk to an old SSH1 server, so -N doesn't work anyway.
There's an open enhancement request for this:
http://bugzilla.mindrot.org/show_bug.cgi?id=253
--
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.
- Next message: Darren Tucker: "Re: ssh tunnel, windowless-- possible in puTTY?"
- Previous message: all mail refused: "Re: how to get the PID of an SSH tunnel"
- In reply to: Noah: "Re: how to get the PID of an SSH tunnel"
- Next in thread: Pierre Asselin: "Re: how to get the PID of an SSH tunnel"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|