This works but after the su command you have to wait like 2 minutes
before each command gets executed ?
What did i do wrong ?

import pxssh

try:
            s = pxssh.pxssh()
            s.login ('127.0.0.1', 'gert', '123')
            s.sendline ('uptime')
            s.prompt()
            print s.before
            s.sendline ('ls -l')
            s.prompt()
            print s.before
            s.sendline ('df')
            s.prompt()
            print s.before
            s.sendline ('su')
            s.expect('Password:')
            s.sendline ('123')
            s.prompt()
            print s.before
            s.sendline ('df')
            s.prompt()
            print s.before
            s.sendline ('exit')
            s.logout()

except pxssh.ExceptionPxssh, e:
            print "pxssh failed on login."
            print str(e)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to