From: Mark W. A. <sl...@do...> - 2004-12-21 22:55:34
|
On Tue, Dec 21, 2004 at 03:19:01PM +0100, Niklas Saers wrote: > Hi, I've tried following the docs for pyssh, but I cannot get a client > started. Both 0.3 and CVS install fssa, nbpipe and ptyext only when > doing python setup.py install, no pyssh. I cannot find a pyssh.py in the > distribution either. And when I do Hi, I'm the new maintainer and .. What?! There's documentation? Oh, there it is... > import pyssh > pyssh.run('date', host='HOSTNAME', user='USERNAME', password='PASSWORD') Yup, that's what it says, but that's not the way it is :( I'll add it to my todo list to bring it up-to-date. > I get module has no attribute run. What I'd like to do is to test that > an ssh connection to a host can be made with passwordbased > authentication, for example by running "echo SUCCESS" on the client side. > > If the documentation is out of date, how do I do this with the current > implementation? If the documentation is correct, what am I missing? > Where is pyssh.py? pyssh.py went away when pyssh was restructured as a python package. It didn't really go any where, it just got renamed to __init__.py and pushed under the pyssh directory. When you "import pyssh", the __init__.py is what actually gets loaded. To your question, the way it works now is to instantiate an Ssh object: import pyssh session = pyssh.Ssh(username='me', host='remotehost') session.login() session.sendcmd("date") If there's an ssh-agent running for user 'me' (which if omitted, defaults to the executing user), pyssh will attempt to attach and use that agent. If this happens, you will _not_ get the password prompt you're expecting at login(), it will just work. Otherwise, it should do as you suspect. HTH! mwa -- Mark W. Alexander sl...@do... The contents of this message authored by Mark W. Alexander are released under the Creative Commons Attribution-NonCommercial license. Copyright of quoted materials, if any, are retained by the original author(s). http://creativecommons.org/licenses/by-nc/2.0/ |