popen3 and ssh

Martin von Loewis loewis at informatik.hu-berlin.de
Sat Aug 11 06:00:18 EDT 2001


Michele Campeotto <micampe at f2s.com> writes:

>    Hi, I'm trying to connect to CVS via SSH from a Python script, it 
> works fine when used over a network, but on a local machine it seems 
> that SSH doesn't get the password that I'm sending... anybody can give 
> an hint?
> 
>    cvs_input.write(self.password + '\n')

ssh opens the controlling terminal (/dev/tty) directly to read the
password. I think there is no way to tell ssh to read the password
from stdin. If you want to use ssh locally, you need to create a
pseudo-terminal. Depending on your operating system, this may be an
arbitrarily complex procedure, or not possible at all. With some luck
(e.g. on Linux), you may have the functions posix.openpty and
posix.forkpty to do that.

Regards,
Martin




More information about the Python-list mailing list