s0m*_*001 6 permissions chmod 20.04
我不小心输入sudo chmod -R 777了/varinsted of /var/www,所以现在我无法打开某些应用程序,例如 Skype 或 Ubuntu Software。有没有什么办法解决这一问题?
Rin*_*ind 11
如果你做了chmod -r /var什么都没有改变。
-r不是有效选项/var/是根目录,因此将显示“权限被拒绝”。/var/ 的内容需要是:
drwxr-xr-x 2 root root 4096 dec 11 00:00 backups
drwxr-xr-x 20 root root 4096 okt 23 03:04 cache
drwxrwsrwt 2 root whoopsie 4096 dec 15 18:19 crash
drwxr-xr-x 73 root root 4096 okt 22 09:13 lib
drwxrwsr-x 2 root staff 4096 mrt 23 2022 local
lrwxrwxrwx 1 root root 9 apr 3 2022 lock -> /run/lock
drwxrwxr-x 15 root syslog 4096 dec 15 18:19 log
drwxrwsr-x 2 root mail 4096 mrt 30 2022 mail
drwxrwsrwt 2 root whoopsie 4096 mrt 30 2022 metrics
drwxr-xr-x 3 root root 4096 dec 7 17:18 opt
lrwxrwxrwx 1 root root 4 apr 3 2022 run -> /run
drwxr-xr-x 13 root root 4096 apr 18 2022 snap
drwxr-xr-x 7 root root 4096 mrt 30 2022 spool
drwxrwxrwt 12 root root 4096 dec 15 18:42 tmp
Run Code Online (Sandbox Code Playgroud)
将您的与此进行比较并进行相应调整。
drwxr-xr-x = chmod 755
lrwxrwxrwx = chmod 777
drwxrwsrwt = chmod 2777 and then chmod o+t (with (s) setuid/setgid permissions (t) and sticky bit)
drwxrwxrwt = chmod 777 and then chmod o+t ((t) and sticky bit)
Run Code Online (Sandbox Code Playgroud)
sudo。如果/var/www包含您拥有的网站,您可以执行以下操作:
cd /var/www/
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
Run Code Online (Sandbox Code Playgroud)
这往往可以解决网站 99% 的权限问题。您可能需要手动调整几个文件。
关于命令: chmod 777 几乎从来都不是正确的解决方案。它仅用于符号链接和特殊目录(例如具有粘滞位的 /tmp)。
安全方面的严格模式适用于目录 750(只有用户可以执行,其他人不能执行任何操作),而 640 则适用于不需要执行的文件。这样,当您设置网络服务器并收到错误时,您就知道存在配置问题,可能与错误的用户/组设置有关。
jas*_*nes -1
文件夹应为 755,tmp、crash、metrics 和符号链接除外(通常为 777)
| 归档时间: |
|
| 查看次数: |
2638 次 |
| 最近记录: |