473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

cannot get pexpect to work

Hi,

I'm at a crucial stage in the development of a wide area (multi-host) ssh
wrapper, and need to control what happens when a host requires password
authentication. After installing pexpect, the example script that looks most
inclined to help me (by basically handling this situation,) "passmass.py"
seems to fail, from whatever host to whatever host eg.

[user1@baddog01 scripts]$ ./passmass.py localhost
Username: user1
Current Password:
New Password:
Confirm New Password:
'Timeout exceeded in read().' <<< ?

Does anyone have a clue what's going on?

Many thanks

Andrei.
Jul 18 '05 #1
5 2217
"Peter Hansen" <pe***@engcorp.com> wrote in message
news:3F***************@engcorp.com...
No, but why is it asking for a new password confirmation?
You're just trying to log in, not change the password, aren't
you? Or does passmass.py actually change the passwords, not
just log in? (I don't have the script.) Have you read it?
Perhaps you've misinterpreted what it is supposed to do.


that's exactly right, as I forgot to mention: it changes passwds
on a list of remote systems, this list being the list of args to
the script, which is now linked here btw:

http://area52.homeunix.org/testarea/passmass.py.txt

cheers

A.

Jul 18 '05 #2
the following is completely wrong of course in my own hacked version of the
script linked in the previous msg:

# SHELL_PROMPT = '[#\$] '
SHELL_PROMPT = '[$?] ${PWD#${PWD%/*/*/*}/}> '

but even when the login shell prompt on remote machine must end in # or $ as
the script insists, and you leave

SHELL_PROMPT = '[#\$] '

the "timed out" message persists, hence my puzzlement ...

A.
Jul 18 '05 #3
Andrei wrote:

"Peter Hansen" <pe***@engcorp.com> wrote in message
news:3F***************@engcorp.com...
No, but why is it asking for a new password confirmation?
You're just trying to log in, not change the password, aren't
you? Or does passmass.py actually change the passwords, not
just log in? (I don't have the script.) Have you read it?
Perhaps you've misinterpreted what it is supposed to do.


that's exactly right, as I forgot to mention: it changes passwds
on a list of remote systems, this list being the list of args to
the script, which is now linked here btw:

http://area52.homeunix.org/testarea/passmass.py.txt


Unfortunately at this moment (13:45 EDT) I get no response to
connection requests on port 80. (That is, server is answering
pings, but no web server on standard port.)

-Peter
Jul 18 '05 #4
> Unfortunately at this moment (13:45 EDT) I get no response to
connection requests on port 80. (That is, server is answering
pings, but no web server on standard port.)


sorry, I had to bring the homeserver down because of a bad thunderstorm ...
after which someone else must have taken the ip address=)

here it is on another server which is altogether more impervious to
meteorogical changes ...

http://tufish.org/misc/passmass.py.txt
Jul 18 '05 #5
"Peter Hansen" <pe***@engcorp.com> wrote in message
news:3F**************@engcorp.com...
Best solution: this is Python (!), so just start up an interactive
session and type the relevant commands yourself, based on what you
see in pexpect.py. Not only will you solve the problem, but you'll
end up with a much better understanding of pexpect.py and the passmass.py
script as well.


An interactive session certainly did the trick.
child = pexpect.spawn('ssh lxplus003 uptime')
try:

.... child.expect('password:')
.... print "problem encountered, password needed"
.... except Exception:
.... print "ok no passwd required"
....
0
problem encountered, password needed
I still haven't figured out why passmass.py isn't finishing and indeed times
out yet, but a basic understanding of pexpect is now creeping up on me, and
how it could help my project.

Thanks,

A.
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Adrian Casey | last post by:
I have a collection of tcl expect scripts which I am converting to python using the excellent pexpect module (http://pexpect.sourceforge.net/). So far I've had great success in getting all my...
1
by: Baillargeon, Sonny | last post by:
I am trying to use a pexpect script using python v2.3.4 with pexpect module .999 on Solaris 8. I try to execute this script. #!/usr/bin/env python '''This runs "ls -l" on a remote host using...
5
by: funkyj | last post by:
I love pexpect because it means I may never have to use expect again (I don't do any heavy expect lifting -- I just need simple tty control)! As a python advocate I find it embarassing how...
5
by: half.italian | last post by:
Hi all. I try not to post until I am stuck in hole with no way out. I fought with this for several hours, and am currently in the hole. I'm doing a proof of concept for creating afp shares...
1
by: Kevin Erickson | last post by:
Hello, I am attempting to use pexpect in python to copy files from a server using scp; the copy works however exceptions are thrown and it exits unsuccessfully. Below is the a sample code and...
8
by: asgarde | last post by:
hello, I'm new in Python and i would like to use Pexpect to execute a root command (i want to mount via a Pyhton script a drive) so that's my script for the moment : from os import *...
5
by: crybaby | last post by:
I need to ssh into a remote machine and check if mytest.log file is there. I have setup ssh keys to handle login authentications. How do I determine if mytest.log is there by using Pexpect. What...
3
by: Karim Bernardet | last post by:
Hi I am using pexpect to do ssh tunneling and to open a vnc server (jobs on a grid cluster). When the job is canceled, these 2 processes remain on the worker node (they are detached), so I have...
1
by: darshak bavishi | last post by:
got ready made code for ssh to unix using python host machine is windows now when i run this its gives following error : Traceback (most recent call last): File...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.