Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkdir -p fails on existing directories that the current user doesn't have permission to access #6542

Open
FSMaxB opened this issue Jul 6, 2024 · 2 comments

Comments

@FSMaxB
Copy link

FSMaxB commented Jul 6, 2024

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 /root as 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.

@FSMaxB
Copy link
Author

FSMaxB commented Jul 6, 2024

Reproducable on both 8cc129cff89523ea0f26ca23e3ca3de660041968 as well as 0.0.27.

@sylvestre
Copy link
Sponsor Contributor

interesting, it might be consider as a bug/weakness of GNU coreutils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants