>
> Well, there's a Python library called "paramiko" which implements ssh.
> That might help.
>
> Later I will try lol.
> Note also that since stdin and stdout are pipes and not the terminal
> then ssh will not be interactive, and will not allocate a tty at the far
> end either. You can get ssh to open a remote tty with the -t option.
>
> But I suspect you don't want stdin=PIPE or stdout=PIPE at all. Why are
> they there?
>
> I thought I can use ps.stdin.write(password), so I make stdin and stdout
be pipe as input and output.
Here are I tried:
>from subprocess import Popen, PIPE
>ps = Popen('ssh -o \'StrictHostKeyChecking no\' [email protected] \'sudo
sysctl -w vm.drop_caches=3\', shell=True)
> [email protected]'s password:
>from subprocess import Popen, PIPE
>ps = Popen(['ssh', '-o \'StrictHostKeyChecking no\'', '
[email protected]', '\'sudo sysctl -w vm.drop_caches=3\''])
> [email protected]'s password:
It always prompt immediately, that make me hard to enter password.
Maybe I should try paramiko...
--
https://mail.python.org/mailman/listinfo/python-list