source: CMTManagement/utils/sshls.py @ 421

Last change on this file since 421 was 421, checked in by garonne, 17 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'''
5import pexpect
6import getpass
7
8host = raw_input('Hostname: ')
9user = raw_input('User: ')
10password = getpass.getpass('Password: ')
11
12child = pexpect.spawn("ssh -l %s %s /bin/ls -l"%(user, host))
13
14child.expect('password:')
15child.sendline(password)
16
17child.expect(pexpect.EOF)
18
19print child.before
20
Note: See TracBrowser for help on using the repository browser.