Skip to content

Commit

Permalink
Only use username from ssh config as default
Browse files Browse the repository at this point in the history
If a username is specified in the `Login` keyword, it should supersede
the username from the ssh config.
  • Loading branch information
Franz Heger committed Jan 20, 2025
1 parent cc41030 commit 38c2aaf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/SSHLibrary/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,10 @@ def _login(self, username, password, allow_agent=False, look_for_keys=False, pro
read_config=False, jumphost_connection=None, keep_alive_interval=None):
if read_config:
hostname = self.config.host
self.config.host, username, self.config.port, proxy_cmd = \
self.config.host, username_from_config, self.config.port, proxy_cmd = \
self._read_login_ssh_config(hostname, username, self.config.port, proxy_cmd)
if not username or username == b'None':
username = username_from_config

sock_tunnel = None

Expand Down

0 comments on commit 38c2aaf

Please sign in to comment.