-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Error when building to a folder not owned by the Hugo process #7302
Comments
Can you please check the file rights on the folder? |
@davidsneighbour Thank you for having a look at my issue report. I'm aware of the safety aspects of this, I simply constructed an example that should make it easy to reproduce what I reported. Let me make it step by step, basically as described in my initial post. Listing before manually creating
Creating the public folder, and setting rights accoring to your suggestion:
Here is the listing with the
Triggering build:
Clearly It is not clear to me why it is important to trigger chtimes on the folder containing the produced content. |
That is weird. With those file rights I would expect everyone being able to change things in the folder. I googled around and found, that chtimes is a GO function, not a shell thing - assumed the first. It might still be file rights related, see the following issue unrelated:
What's the operating system you are using here? |
I've verified it using both Debian and Ubuntu. |
I can confirm that it's not docker related. I tried on my own repo locally with a root user created public folder (process got frozen) that was then set to 0777 (process ended up with a chtimes error). So it's probably an issue in how chtimes is called in Go or Hugo.
This all does not solve the mystery why you would create a folder owned by root instead of creating a folder owned by a more public user (the one running hugo, or a completely public one). Some ideas that probably won't work:
This is where my knowledge about the system ends and @bep or another Go-God might have a look at it. |
It is not related to the root user. Try making the folder this way (1337 or other uid not used): $ mkdir public
$ chmod 0777 public
$ sudo chown 1337 public Please notice the group ownership is not changed in the above commands. This will result in the same error when triggering Hugo. The |
Does it work if you do
Or maybe
|
Using |
OK, so this is what's giving a permission error https://golang.org/pkg/os/#Chtimes |
I also ran into this, I want a user to be able to run this without owning the files in question (group access). I guess chtimes is a user-level permission? I made a uhugo shortcut that aliases to hugo --noTimes - maybe this shouldn't be a default option (or detect if you have the permissions and warn instead of fail). |
@smaudet You can set |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes it does.
The error occures when the Hugo process have write access to the destination folder but does not own it.
To reproduce, create a
public
folder owned by root in your Hugo site project (requires sudo access):sudo sh -c "mkdir public && chmod a+w public"
Run Hugo:
Log:
The text was updated successfully, but these errors were encountered: