Background process for ssh port forwarding

Jesse Rosenthal jr2075 at columbia.edu
Sun Oct 2 09:51:38 EDT 2005


On Sun, 02 Oct 2005 08:44:48 +0200, Fredrik Lundh wrote:

> Jesse Rosenthal wrote:
> 
>> If I end this with 'connection.interact()', I will end up logged in to the
>> forwarding server. But what I really want is to go on and run rsync to
>> localhost port 2022, which will forward to my_server port 22. So, how can
>> I put the ssh connection I set up in hostforward() in the background?
>> I need to make sure that connection is made before I can run the rsync
>> command.
> 
> $ man ssh
> 
>     ...
> 
>      -f      Requests ssh to go to background just before command execution.
>              This is useful if ssh is going to ask for passwords or
>              passphrases, but the user wants it in the background.  This
>              implies -n.  The recommended way to start X11 programs at a
>              remote site is with something like ssh -f host xterm.
> 
>     ...

Thanks for the response. I had tried that, but the problem is that it
requires that I specify some command on the server (in this case, the
forwarding server) which it executes with ssh in the bg, and then exits.
But maybe I could just run "sleep 10" or something on the server to keep
the port open long enough to ssh through it? I'll give a few things like
that a try.





More information about the Python-list mailing list