Skip to content

bug(sftp): regular OpenSSH key auth broken after asyncssh migration #49

Description

@Orinks

Description

After the asyncssh migration (#44), connecting via a regular OpenSSH private key (non-PPK) fails. The key path is set correctly but the connection does not authenticate.

Root Cause (suspected)

In protocols.py, when key_path is set, the password field is consumed as the key passphrase even if it's empty/None. asyncssh may also need client_key_passphrase set separately from password, and the two auth methods (key + password fallback) should not be mutually exclusive.

passphrase = self._info.password if self._info.password else None
connect_kwargs["client_keys"] = [key_path]
connect_kwargs["passphrase"] = passphrase  # wrong — swallows password as passphrase

Fix

  • Use client_keys_passphrase (not passphrase) if the key is encrypted
  • Allow password fallback alongside key auth
  • Don't set passphrase=None when no passphrase is provided

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions