python connect to server using SSH protocol

Laszlo Zsolt Nagy gandalf at geochemsource.com
Tue Feb 8 09:20:20 EST 2005


>
> import os
> fi, foe = os.popen4 ('ssh dopey')
> print >>fi, 'ls'
> fi.close ()  # <-- this is annoying
> for line in foe:
>    print line,
> foe.close ()
>
> The above connects to a server, passes the command 'ls', which is 
> executed there, and prints the returned result.
>
> However, reading from foe succeeds only if fin has been closed before. 
> An fi.flush() seems to be not sufficient. 

Hmm. Is it possible to use ssh for simple port forwarding (-L option) 
and write a server program on the remote machine?



-- 
_________________________________________________________________
  Laszlo Nagy		      web: http://designasign.biz
  IT Consultant		      mail: gandalf at geochemsource.com

     		Python forever!





More information about the Python-list mailing list