Skip to content

Create directories with execute permissions so they can be opened#395

Merged
tlimoncelli merged 2 commits intoStackExchange:masterfrom
arafferty:fix_mkdir_perms
Aug 27, 2018
Merged

Create directories with execute permissions so they can be opened#395
tlimoncelli merged 2 commits intoStackExchange:masterfrom
arafferty:fix_mkdir_perms

Conversation

@arafferty
Copy link
Copy Markdown
Contributor

get-certs currently fails with a permission denied after it creates new directories because MkdirAll is using 0644 instead of 0755. This PR resolves that.

@captncraig
Copy link
Copy Markdown
Contributor

captncraig commented Aug 25, 2018 via email

@arafferty
Copy link
Copy Markdown
Contributor Author

Ubuntu 16.04 on ext4. Same behavior on OS X. My bet is that your tests are being run with root permissions (docker? Windows?). The execute bit has to be set on directories in order for users to be able to enter and access files inside that directory (https://superuser.com/questions/168578/why-must-a-folder-be-executable). root obviously gets to ignore this detail.

What this means is that the MkdirAll call creates the certs directory but then subsequently fails when run as a non-root user when it tries to do anything inside of that directory (I haven't checked but my guess is that it tries to list the contents of the directory to see if it needs to create the next directory in the tree and fails).

0700 seems like a perfectly reasonable setting so that non-root users can still interact with the directory. I was just copying the generally permissive setting on the files themselves. While I'm fiddling with permissions should I also change it so that the files themselves are created as 0600?

@tlimoncelli
Copy link
Copy Markdown
Contributor

0700 seems reasonable to me.

@tlimoncelli tlimoncelli merged commit 402fc44 into StackExchange:master Aug 27, 2018
rblenkinsopp pushed a commit to rblenkinsopp/dnscontrol that referenced this pull request Aug 21, 2020
…ned (StackExchange#395)

* Create directories with execute permissions so they can be opened
* Use 0700 permissions on certificate directories instead of 0755
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

Successfully merging this pull request may close these issues.

3 participants