From 0f91add86f7d30e6d895e01bbfddb93a3b5e48df Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Mon, 23 Jun 2014 15:56:40 -0500 Subject: [PATCH] Explicitly set the user option for ssh connections Fixes #7170 --- lib/ansible/runner/connection_plugins/ssh.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index ec5d6edd340..bddbd88af34 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -94,8 +94,7 @@ class Connection(object): self.common_args += ["-o", "KbdInteractiveAuthentication=no", "-o", "PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey", "-o", "PasswordAuthentication=no"] - if self.user != pwd.getpwuid(os.geteuid())[0]: - self.common_args += ["-o", "User="+self.user] + self.common_args += ["-o", "User=" + (self.user or self.user or pwd.getpwuid(os.geteuid())[0])] self.common_args += ["-o", "ConnectTimeout=%d" % self.runner.timeout] return self