Hi, I need to run and get the result of a command on a remote server through an ssh client. I can't find the way to send the password to the server. But I'm always asked interactively for the password through the console despite I write the "sh.tochild.write(passwd)" Please help ! server = 'myserver' user = 'myself' passwd = 'mysecret' command = 'ls -la' import popen2 def rmtCmd(acmd): ''''builds a string suited to execute a command through ssh''' global user, server return 'ssh -l %s %s %s' % (user, server, acmd) sh = popen2.Popen3('') if __name__ == '__main__': # Tests stuffs rcmd = rmtCmd(command) sh = popen2.Popen3(rcmd) sh.tochild.write(passwd) sh.wait() print sh.fromchild.read() I've tried other combinations to get it working... desperately !
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4