-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
I stumbled upon this from a weird ansible error.
$ ansible -m ping <redacted-hostname> --become-user unprivileged-user
<redacted-hostname> | UNREACHABLE! => {
"changed": false,
"msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo /var/tmp `\"&& mkdir \"` echo /var/tmp/ansible-tmp-1720284467.1994517-229738-239118036920172 `\" && echo ansible-tmp-1720284467.1994517-229738-239118036920172=\"` echo /var/tmp/ansible-tmp-1720284467.1994517-229738-239118036920172 `\" ), exited with result 1",
"unreachable": true
}
Turns out that this error went away when replacing mkdir from uutils with the original GNU mkdir.
This can be reproduced very easily:
- Run
mkdir -p /rootas a non-root user
With the GNU Coreutils mkdir (version 9.4), this works without any issues.
With the uutils mkdir, it prints mkdir: cannot set permissions '/root': Permission denied with exit status 1.