2

I am trying to use Paramiko to connect to a remote host via ssh however I get an error message which states that keyboard authentication is required to access the host. Is there any way I can get around this using Paramiko? If not, is there another ssh module I can use? I'll even use another language if I have to. The only thing I can't do is change the settings on the host. Also, I am writing this application on a Windows host so pxssh is not an option. Any suggestions?

Albert
  • 21
  • 1

2 Answers2

-1

You could get username and password from whatever resource you have and use it when calling connect. For example you could save them in a config file.

UlfR
  • 4,175
  • 29
  • 45
-1

Either pass the private key directly using pkey= or pass in the name of the file with key_filename= when calling connect() like so:

client = SSHClient()
client.connect('remotehost', key_filename='/path/to/private_key')

or

private_key = """
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIMhTkzF8pZ5gtXvAafjNRsKXWXnhjslUW194WteddA3YoAoGCCqGSM49
AwEHoUQDQgAEkb0qngPKOKVcjqszHg+7Y95TLvWZb5qtHb4ZmuLJRYIMzx78C9gp
sb3jBuW2VCaoO8SfyXUKeOzT7eJTH6j8GQ==
-----END EC PRIVATE KEY-----
""""
client = SSHClient()
client.connect('remotehost', pkey=private_key)
aculich
  • 14,545
  • 9
  • 64
  • 71