paramiko / paramiko/paramiko

BadAuthenticationType or SSHException when no authentication method needed

Open
#1,448 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9.9k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

I believe this issue may be related to #787.

Basically, although OpenSSH's client succeeds:

debug1: Authentication succeeded (none).

Trying to connect with Paramiko either with generic password or None as password does not work.

I think that None and disabling key based authentication should work, indicating to the client library that no authentication method is the expected.

>>> ssh.connect(hostname='', username='root', password='Password', port=48409, timeout=30, compress=True, look_for_keys=False, allow_agent=False, auth_timeout=30, banner_timeout=30)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 437, in connect
    passphrase,
  File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 749, in _auth
    raise saved_exception
  File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 736, in _auth
    self._transport.auth_password(username, password)
  File "/usr/local/lib/python3.7/site-packages/paramiko/transport.py", line 1436, in auth_password
    return self.auth_handler.wait_for_response(my_event)
  File "/usr/local/lib/python3.7/site-packages/paramiko/auth_handler.py", line 250, in wait_for_response
    raise e
paramiko.ssh_exception.BadAuthenticationType: ('Bad authentication type', ['']) (allowed_types=[''])
>>> ssh.connect(hostname='', username='root', password=None, port=48409, timeout=30, compress=True, look_for_keys=False, allow_agent=False, auth_timeout=30, banner_timeout=30)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 437, in connect
    passphrase,
  File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 750, in _auth
    raise SSHException("No authentication methods available")
paramiko.ssh_exception.SSHException: No authentication methods available

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the authentication flow shown in paramiko/client.py, especially connect and _auth, then trace transport.py and auth_handler.py for auth_password and the no-method response. Reproduce the OpenSSH-style none-authentication case and verify that a connection succeeds when no password or key authentication is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.