Background process for ssh port forwarding

Fredrik Lundh fredrik at pythonware.com
Sun Oct 2 02:44:48 EDT 2005


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.

    ...

</F>






More information about the Python-list mailing list