Skip to content

Commit 2cd9cb2

Browse files
author
Franz Heger
committed
Only use username from ssh config as default
If a username is specified in the `Login` keyword, it should supersede the username from the ssh config.
1 parent cc41030 commit 2cd9cb2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/SSHLibrary/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,10 @@ def _login(self, username, password, allow_agent=False, look_for_keys=False, pro
882882
read_config=False, jumphost_connection=None, keep_alive_interval=None):
883883
if read_config:
884884
hostname = self.config.host
885-
self.config.host, username, self.config.port, proxy_cmd = \
885+
self.config.host, username_from_config, self.config.port, proxy_cmd = \
886886
self._read_login_ssh_config(hostname, username, self.config.port, proxy_cmd)
887+
if not username:
888+
username = username_from_config
887889

888890
sock_tunnel = None
889891

0 commit comments

Comments
 (0)