On Sep 10, 6:04 pm, [EMAIL PROTECTED] wrote: > Hey , I need to SSH into a server .. (10.8.42.38) using pexpect the > username is 'admin' and password is 'abc123' so far i have the > following code > > import pexpect > import sys > import time > import os > > foo = pexpect.spawn('ssh [EMAIL PROTECTED]') > ssh_newKey = 'Are you sure you want to continue connecting' > > foo.expect = ssh_newKey > foo.send = 'yes' > foo.expect = 'password:' > foo.send = 'abc123' > > --------------------------------------------------------------------------- > ---------------------- > > does this look right? > > if not , could someone suggest a way to do this .. > your help is much appreciated
https://svn.lal.in2p3.fr/projects/CMT/CMTManagement/utils/ssh_session.py I use a modified version of this. Simple and effective. import ssh_session ssh = ssh_session.ssh_session(user, host, password) print ssh.ssh("ls -l /tmp") Thanks Eric and Nigel! ~Sean -- http://mail.python.org/mailman/listinfo/python-list