Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support for ssh with password #173

Open
fruch opened this issue Feb 7, 2015 · 7 comments
Open

Windows support for ssh with password #173

fruch opened this issue Feb 7, 2015 · 7 comments

Comments

@fruch
Copy link

fruch commented Feb 7, 2015

I was trying to do this:

mach = SshMachine("10.57.33.XX", user="root", password="something")

and it failed on:

plumbum.commands.processes.CommandNotFound: ('sshpass', ....

looking at the code, I've found PuttyMachine... that should work better...

mach = PuttyMachine("10.57.33.XX", user="root", password="something") 
# yielded this 
Traceback (most recent call last):
File "C:/split_braaa.py", line 10, in <module>
    mach = PuttyMachine("10.57.33.XX", user="root", password="something")
TypeError: __init__() got an unexpected keyword argument 'password'

So how can I use Plumbum SSH on windows ?

@fruch
Copy link
Author

fruch commented Feb 7, 2015

Later I've found out the ParamikoMachine, but not much luck with getting it to work on Windows.
together with rpyc ZeroDeply feature, I was just hanging there when calling server.classic_connect()

the PuttyMachine was working at the end, but with breaking linux support (both in rpyc and plumbum, as can seen in their TravisCI pages )

@msvbhat
Copy link

msvbhat commented Aug 25, 2015

Hi,

I tried connecting to Windows machine from linux client. I was running freesshd in windows to get access to powershell. And from the bash, I can login to powershell (just like ssh) and run my commands.

But when I tried to connect via plumbum.SshMachine (from linux to windows) I get the backtrace.

>>> from plumbum import SshMachine
>>> rem = SshMachine("xx.xx.xx.xx", user="root")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/plumbum/machines/ssh_machine.py", line 106, in __init__
    new_session = new_session)
  File "/usr/lib/python2.6/site-packages/plumbum/machines/remote.py", line 129, in __init__
    self._session = self.session(new_session = new_session)
  File "/usr/lib/python2.6/site-packages/plumbum/machines/ssh_machine.py", line 150, in session
    self.encoding, isatty, self.connect_timeout)
  File "/usr/lib/python2.6/site-packages/plumbum/machines/session.py", line 141, in __init__
    self.run("")
  File "/usr/lib/python2.6/site-packages/plumbum/machines/session.py", line 224, in run
    return run_proc(self.popen(cmd), retcode)
  File "/usr/lib/python2.6/site-packages/plumbum/commands/processes.py", line 186, in run_proc
    stdout, stderr = proc.communicate()
  File "/usr/lib/python2.6/site-packages/plumbum/machines/session.py", line 92, in communicate
    line = pipe.readline()
  File "/usr/lib/python2.6/site-packages/plumbum/machines/session.py", line 42, in readline
    raise EOFError()
EOFError

Any Idea?

@henryiii
Copy link
Collaborator

This usually means that the error channel is not accessible, usually because it could not be redirected via Bash syntax on the remote machine. I've not connected to a Windows computer, but I'm assuming that it doesn't have Bash accessible to the ssh connection? The remote has to be able to support something like 2>&1.

Have you tried ParamikoMachine?

@msvbhat
Copy link

msvbhat commented Aug 26, 2015

Thanks. The shell running in remote machine is not bash (AFAIK). So I will have to try and run different machine.

When I try ParamikoMachine, it hangs and never completes. I am not sure where this hangs. Have any idea how ParamikoMachine works? Some pointer to debug it?

@henryiii
Copy link
Collaborator

I've never really looked into ParamikoMachine, I plan to at some point, but for now, I don't know much about it. Can you see where it hangs by using Control C?

@msvbhat
Copy link

msvbhat commented Aug 26, 2015

Control C does not kill the process. I have to kill the python process to get back my shell.

If you take a look and find a way, please let me know. Thanks.

@yash-1997
Copy link

Later I've found out the ParamikoMachine, but not much luck with getting it to work on Windows.
together with rpyc ZeroDeply feature, I was just hanging there when calling server.classic_connect()

the PuttyMachine was working at the end, but with breaking linux support (both in rpyc and plumbum, as can seen in their TravisCI pages )

How did PuttyMachine start working in the end? How did you fix the password parameter not found error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants