From dfc4a9e60a50b1782bb21c10c1bc6927d56c540f Mon Sep 17 00:00:00 2001 From: Kevin Riggle Date: Sat, 18 Feb 2017 07:19:54 -0500 Subject: [PATCH] pass DISPLAY and SSH_ASKPASS through to ssh-agent if set --- ssh-ident | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ssh-ident b/ssh-ident index 6147703..a09edc4 100755 --- a/ssh-ident +++ b/ssh-ident @@ -795,8 +795,14 @@ class AgentManager(object): print("Preparing new agent for identity {0}".format(identity), file=sys.stderr, loglevel=LOG_DEBUG) + + envs = [] + if 'DISPLAY' in os.environ: + envs.append("DISPLAY={0}".format(os.environ['DISPLAY'])) + if 'SSH_ASKPASS' in os.environ: + envs.append("SSH_ASKPASS={0}".format(os.environ['SSH_ASKPASS'])) retval = subprocess.call( - ["/usr/bin/env", "-i", "/bin/sh", "-c", "ssh-agent > {0}".format(agentfile)]) + ["/usr/bin/env", "-i"] + envs + ["/bin/sh", "-c", "ssh-agent > {0}".format(agentfile)]) return agentfile @staticmethod