Re: yet another SSH question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08Mar2008 03:24, Gordon Messmer <yinyang@xxxxxxxxx> wrote:
> tony.chamberlain@xxxxxxxxx wrote:
>>
>>     ssh -X -oBatchMode=yes -o TCPKeepAlive=yes -l support1 -L
>>     10005:192.168.20.5:22 -L 10010:192.168.20.10:22 -L
>>     10020:192.168.20.20:22 -L 10030:192.168.20.30:22 -L
>>     10040:192.168.20.40:22 -L 10050:192.168.20.50:22 $OUTSIDEIP
>>
> ...
>> However, when I put sstest into the background like that, then none of the 
>> port forwarding ssh and scp commands
>> works.
>
> You need to use the -n option.

He's probably better off with -f and no ampersand, because that will 1)
attach stdin from /dev/null like -n does and 2) fork off into the
background only _after_ the ssh connection is up. Without that
synchronisation (plain "&" approach) his script may start the other
tunneled ssh commands before the ssh tunnel itself is up. And it has the
bonus that you can test if the tunnel came up:

  if ssh -f .....
  then
    tunnel-using-ssh-commands-here...
  else
    whoops, main ssh failed for some reason
  fi

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux