大网数据广告活动
网站运营与故障问答

Is it safe to use 777 for my public html folder?

· 52CE 我爱测

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 t…

问题原文

原帖链接 · liminalFrog · CC BY-SA 4.0

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.

社区高分解答

原帖链接 · davidgo · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2022-01-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。