2

I am hacking away on a remote helper for git. The script is in bourne shell.

I wanted to create some temporary directory in the home dir. For some reason I get permission denied. From my shell directly I can run the same command without problems.

All the Environment vars look normal, $HOME, $USER, ... The homedir has normal permissions set (eg. everything is owned an writable by the user). I'm using debian testing.

This is the offending command:

mkdir --mode=600 --parents /home/<user>/.tmp/$$

The peculiar thing is also that the directory is effectively created, but the next line that tries to put a file in it has a permission denied again and this time the file is not created.

The shell is running with:

set -e # errexit
set -u # nounset
set -f # noglob
set -C # noclobber

set -x

but without them I still get permission denied.

ps: I just tried in the $GIT_DIR, to which the user has write privileges too, and also permission denied, but this time not on the directory creation, but on the file creation the next line.

So how do I find out who is denying me and why?

closed as off-topic by Gilles, Renan, slm, Braiam, jasonwryan Apr 25 '14 at 2:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Gilles, Renan, slm, Braiam, jasonwryan
If this question can be reworded to fit the rules in the help center, please edit the question.

  • What user is the script being ran as? – Bratchley Apr 24 '14 at 21:17
  • @JoelDavis not quite sure what you mean, a normal user, uid 1000+... – user13666 Apr 24 '14 at 21:24
  • 2
    You are using mode 0600 (u=rw) which lacks the execute bit which is required for a directory in order to create files inside it. – jw013 Apr 24 '14 at 21:34
  • @jw013 Thanks alot, that's it. However then I got "cannot create !: File exists" which was blatantly untrue. I was creating it by redirecting to it with >! because of the noclobber, but when making that just > it works. – user13666 Apr 24 '14 at 21:47
  • @nus The redirection operator in sh is >|, not >!. >! is the csh equivalent (zsh has both). – Gilles Apr 24 '14 at 23:16