From fa9bfbba137a6d151e5b2d4cdfe0c5948ae4c0c9 Mon Sep 17 00:00:00 2001 From: Stephen Fromm Date: Fri, 11 May 2012 11:48:31 -0700 Subject: [PATCH] Fix for sudo to another non-root user (issue #353) mktemp creates the temp directory 700 only. If the sudo-user is not root, the other user will not be able to run the command (Permission denied error). This adds the executable bit for all on the temp directory. --- lib/ansible/runner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index 95b04cb1a4..71f657af3d 100644 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -666,6 +666,9 @@ class Runner(object): result, err = self._exec_command(conn, cmd, None, sudoable=False) cleaned = result.split("\n")[0].strip() + '/' + if self.remote_user != 'root': + cmd = 'chmod a+x %s' % cleaned + result, err = self._exec_command(conn, cmd, None, sudoable=False) return cleaned