python - EOF exception while using pexpect for ssh password prompt -


so wrote following after reading pexpect docs:

import pexpect pexpect import popen_spawn child = popen_spawn.popenspawn("ssh -t -t root@server1") child.expect('password:') child.sendline('pwd')        # send password 

now here's error i'm getting:

traceback (most recent call last):   file "c:\ssh_exp.py", line 4, in <module>     child.expect('password:')   file "c:\python27\lib\site-packages\pexpect\spawnbase.py", line 315, in expect     timeout, searchwindowsize, async)   file "c:\python27\lib\site-packages\pexpect\spawnbase.py", line 339, in expect_list     return exp.expect_loop(timeout)   file "c:\python27\lib\site-packages\pexpect\expect.py", line 102, in expect_loop     return self.eof(e)   file "c:\python27\lib\site-packages\pexpect\expect.py", line 49, in eof     raise eof(msg) pexpect.exceptions.eof: end of file (eof). <pexpect.popen_spawn.popenspawn object @ 0x0000000002ba3f98> 

i have verified connectivity server1 proper , ssh not close without prompting password. there i'm missing here?

in general, happens when expect ('password'), not found in output.

there situations, when server requested install public key on machine , should expect '(yes/no)?' - below output.

he authenticity of host ' ' can't established. ecdsa key fingerprint x:xx:35:ae:1a:2e:69:e4:4d:b4:5e:2d:02:xx:f2:ed. sure want continue connecting (yes/no)?


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -