1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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.
This commit is contained in:
Stephen Fromm 2012-05-11 11:48:31 -07:00
parent 36639186e0
commit fa9bfbba13

View file

@ -666,6 +666,9 @@ class Runner(object):
result, err = self._exec_command(conn, cmd, None, sudoable=False) result, err = self._exec_command(conn, cmd, None, sudoable=False)
cleaned = result.split("\n")[0].strip() + '/' 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 return cleaned