have someone succeed to do ssh connection using using paramiko module and dropbear in python2.7?

736 Views Asked by At

Has someone succeed to do ssh connection using paramiko module and dropbear in python2.7? I get "Authentication failed" error when executing the code below

ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("IP", username = "root")

The error which I get is.

File "/usr/local/lib/python2.7/dist-packages/Qb/QbUnittest/QbUnittest.py", line 624, in __call__
testMethod()
File "testDropBear_send_file.py", line 34, in runMe
    ssh.connect(self.terminal.xmlTerminalCfg.getIp(), username = USER_NAME)
File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 367, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
    File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 584, in _auth
    raise saved_exception
AuthenticationException: Authentication failed.

P.S There is no need password for username "root". Dropbear version is 2016.73. paramiki 1.16. python 2.7

1

There are 1 best solutions below

2
On

For empty passwords (needless to say this is not recommended in terms of security) you have to explicitly set password="" in the run() call:

ssh.connect("IP",
            username = "root",
            password="",
            look_for_keys=False,
            allow_agent=False)