From 4b55b460eaffb35466b614868682fa4f2a545c4e Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 16 Aug 2026 07:01:55 +0200 Subject: [PATCH] lib.ec.ssh.Paramiko: Pass port and password __client() connects using only the URI's hostname and username. The URI's port is ignored, so ssh://host:2222/... ends up connecting to port 22, and a password carried in the URI is never passed to paramiko, so URI-based password authentication cannot work. The Exec and AsyncSSH clients both honor the port and the password. Pass the port and the password to connect(). The port argument is omitted entirely when the URI carries no port, because getaddrinfo() would interpret a None port as service port 0; without the argument, paramiko falls back to its default of 22. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2 Signed-off-by: Jan Lindemann --- src/python/jw/pkg/lib/ec/ssh/Paramiko.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/python/jw/pkg/lib/ec/ssh/Paramiko.py b/src/python/jw/pkg/lib/ec/ssh/Paramiko.py index 84ac0d9e..0af7af48 100644 --- a/src/python/jw/pkg/lib/ec/ssh/Paramiko.py +++ b/src/python/jw/pkg/lib/ec/ssh/Paramiko.py @@ -32,10 +32,16 @@ class Paramiko(Base): hostname = self.hostname if hostname is None: raise Exception('Tried to run connect without target hostname') + kwargs: dict[str, Any] = { + 'hostname': hostname, + 'username': self.username, + 'password': self.password, + 'allow_agent': True, + } + if self.port is not None: + kwargs['port'] = self.port try: - ret.connect( - hostname = hostname, username = self.username, allow_agent = True - ) + ret.connect(**kwargs) except Exception as e: log(ERR, f'Failed to connect to {self.hostname} ({str(e)})') raise