[paramiko] Sending stdin to a sshd-spawned process

Tobias Mueller muelli at cryptobitch.de
Wed Feb 18 17:10:55 PST 2009


Hi folks :)

I basically want to do the following:

Imagine I have a printer daemon which has an SSH interface. The SSHd 
attaches the "lpr" process right after logging in. That process expects 
the to-be-printed document on stdin and give a status on stdout. So I 
can print with a command like that:

   $ cat doc.ps | ssh printer
   Printed 1 page


I want to replace that with a (paramiko based) python script to do
   $ sshprint doc.ps


(Instead of a printer, you might think of a git-ssh, hg --serve or rsync 
being attached to the ssh session right after authentification. I hope 
my point is clear by now.)



I am, however, not able to do exactly that with paramiko, which might be 
due to my limited SSH knowledge as well.

I tried stdin, stdout, stderr = client.exec_command('') and just write 
to stdin, but stdout is never readable.
I also looked through last years archives and googled for "paramiko 
stdin non-interactive" but I didn't get any useful results.

So if anyone could enlighten me, I'd be glad :)

TIA
   Tobi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://www.lag.net/pipermail/paramiko/attachments/20090219/34cda838/attachment.pgp 


More information about the paramiko mailing list