Interaction with the shell

Gillou nospam at bigfoot.com
Sat Feb 1 08:13:37 EST 2003


"Erik Max Francis" <max at alcyone.com> a écrit dans le message de news:
3E3B4AC6.276E78A2 at alcyone.com...
> Tyson Tate wrote:
>
> > I'd like to enter the password from within the code (i.e. so that the
> > user doesn't enter the password). How might I do this? The man pages
> > on
> > ssh don't say that there are any parameters through which I can supply
> > the password.
>
> As well there shouldn't be; your password would then be visible to
> anyone with an account on the same machine while you were using it (or
> at least there would be a race condition for it to be visible).
>
> You could probably use something like the PyExpect module (which I've
> never had the pleasure to use myself):
>
> https://sourceforge.net/projects/pexpect/
>
> A much better idea, though, is to avoid the password entirely and
> instead set up a local ssh key with ssh-keygen and add the public key to
> ~/.ssh/authorized_keys on the remote system.  This will obviate the need
> for a password exchange.

And don't give a password for your private key when running ssh-keygen

--Gilles







More information about the Python-list mailing list