5

Running a Linode and I want to install Nextcloud, but it needs permissions to write to the directory (/var/www/html). Doing a chmod 777 will clear things up but I wonder if it's safe to use that open of a permission scheme on the public html directory. Does Nextcloud have some instructions on permissions I can read?

I'm also using Nginx, if that means anything.

1
  • Don't. Give ownership of the nextcloud directory to the user php is running at for nextcloud. Commented Jan 22, 2022 at 19:09

1 Answer 1

8

Define safe.

It's not a best practice. Depending on the scope of your install (e.g. who has access to the system) it may not be a big deal - for example if the only purpose of this machine is to run Nextcloud.

Generally permissions should be 755 on that directory (owner can read, write, enter it) everyone else can only read and enter it. For the nextcloud installer to do its thing the owner of the directory it's being installed in would need to be the web server user - typically nginx. (This could be something else depending on the distro.)

The risk to be mindful of is on a server with multiple (system) users. Having 777 would mean anyone with an account on the server (e.g. users of other websites) could potentially modify/delete the contents of of the website directory. If there are only system accounts + root + your admin account, and if nextcloud is the only thing running the risk is not great, as a compromise won't give access the attacker would not otherwise have. Still it's a bad practice.

The Nextcloud documentation has comments on ownership; it's talking about www-data, that is an ubuntu/apache equivalent of nginx.

1
  • 1
    I use 750 and 640. I've always figured that when people use 755 it's because the group of var/www/html/ isn't the web server. Commented Jan 21, 2022 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.