Last change
on this file since 421 was 421, checked in by garonne, 18 years ago |
|
-
Property svn:executable
set to
*
|
File size:
423 bytes
|
Line | |
---|
1 | #!/usr/bin/env python
|
---|
2 | '''This runs "ls -l" on a remote host using SSH.
|
---|
3 | At the prompts enter hostname, user, and password.
|
---|
4 | '''
|
---|
5 | import pexpect
|
---|
6 | import getpass
|
---|
7 |
|
---|
8 | host = raw_input('Hostname: ')
|
---|
9 | user = raw_input('User: ')
|
---|
10 | password = getpass.getpass('Password: ')
|
---|
11 |
|
---|
12 | child = pexpect.spawn("ssh -l %s %s /bin/ls -l"%(user, host))
|
---|
13 |
|
---|
14 | child.expect('password:')
|
---|
15 | child.sendline(password)
|
---|
16 |
|
---|
17 | child.expect(pexpect.EOF)
|
---|
18 |
|
---|
19 | print child.before
|
---|
20 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.