Linux 组权限混淆

Posted

技术标签:

【中文标题】Linux 组权限混淆【英文标题】:Linux group permissions confusion 【发布时间】:2017-05-03 09:35:51 【问题描述】:

我正在尝试在我的 VM 上的 apache2 上设置一个仅限本地的站点。我以前没有遇到过问题,但今天我设法让自己陷入混乱,试图找出我错过的东西,但仍然无法找出答案。

我的/var/www 文件夹如下所示:

acaeris@Jinx /var/www $ ls -al
total 12
drwxrwxr-x  3 www-data www-data 4096 May  3 10:28 .
drwxr-xr-x 12 root     root     4096 May 28  2015 ..
drwxrwxr-x  2 www-data www-data 4096 May 28  2015 html

acaeriswww-data 组的成员,Netbeans 在acaeris 下运行:

acaeris@Jinx /var/www $ grep -i --color 'www-data' /etc/group
www-data:x:33:acaeris

acaeris@Jinx /var/www $ ps aux | grep 'netbeans'
acaeris   9235  0.0  0.1  12776  2756 ?        S    10:12   0:00 /bin/bash /usr/local/netbeans-8.2/platform/lib/nbexec --userdir /home/acaeris/.netbeans/8.2 --cachedir /home/acaeris/.cache/netbeans/8.2 --jdkhome /usr/local/netbeans-8.2/bin/jre --branding nb --clusters /usr/local/netbeans-8.2/nb:/usr/local/netbeans-8.2/ergonomics:/usr/local/netbeans-8.2/ide:/usr/local/netbeans-8.2/extide:/usr/local/netbeans-8.2/java:/usr/local/netbeans-8.2/apisupport:/usr/local/netbeans-8.2/webcommon:/usr/local/netbeans-8.2/websvccommon:/usr/local/netbeans-8.2/enterprise:/usr/local/netbeans-8.2/mobility:/usr/local/netbeans-8.2/profiler:/usr/local/netbeans-8.2/python:/usr/local/netbeans-8.2/php:/usr/local/netbeans-8.2/identity:/usr/local/netbeans-8.2/harness:/usr/local/netbeans-8.2/cnd:/usr/local/netbeans-8.2/cndext:/usr/local/netbeans-8.2/dlight:/usr/local/netbeans-8.2/groovy:/usr/local/netbeans-8.2/extra:/usr/local/netbeans-8.2/javacard:/usr/local/netbeans-8.2/javafx: -J-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade -J-Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense -J-Xmx400m -J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true
acaeris   9485  8.1 31.8 2762964 651800 ?      Sl   10:12   1:40 /usr/local/netbeans-8.2/bin/jre/bin/java -Djdk.home=/usr/local/netbeans-8.2/bin/jre -classpath /usr/local/netbeans-8.2/platform/lib/boot.jar:/usr/local/netbeans-8.2/platform/lib/org-openide-modules.jar:/usr/local/netbeans-8.2/platform/lib/org-openide-util.jar:/usr/local/netbeans-8.2/platform/lib/org-openide-util-lookup.jar:/usr/local/netbeans-8.2/platform/lib/org-openide-util-ui.jar:/usr/local/netbeans-8.2/platform/lib/locale/boot_ja.jar:/usr/local/netbeans-8.2/platform/lib/locale/boot_pt_BR.jar:/usr/local/netbeans-8.2/platform/lib/locale/boot_ru.jar:/usr/local/netbeans-8.2/platform/lib/locale/boot_zh_CN.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-modules_ja.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-modules_pt_BR.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-modules_ru.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-modules_zh_CN.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util_ja.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-lookup_ja.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-lookup_pt_BR.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-lookup_ru.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-lookup_zh_CN.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util_pt_BR.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util_ru.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-ui_ja.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-ui_pt_BR.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-ui_ru.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util-ui_zh_CN.jar:/usr/local/netbeans-8.2/platform/lib/locale/org-openide-util_zh_CN.jar -Dnetbeans.default_userdir_root=/home/acaeris/.netbeans -Dnetbeans.running.environment=gnome -Dnetbeans.dirs=/usr/local/netbeans-8.2/nb:/usr/local/netbeans-8.2/ergonomics:/usr/local/netbeans-8.2/ide:/usr/local/netbeans-8.2/extide:/usr/local/netbeans-8.2/java:/usr/local/netbeans-8.2/apisupport:/usr/local/netbeans-8.2/webcommon:/usr/local/netbeans-8.2/websvccommon:/usr/local/netbeans-8.2/enterprise:/usr/local/netbeans-8.2/mobility:/usr/local/netbeans-8.2/profiler:/usr/local/netbeans-8.2/python:/usr/local/netbeans-8.2/php:/usr/local/netbeans-8.2/identity:/usr/local/netbeans-8.2/harness:/usr/local/netbeans-8.2/cnd:/usr/local/netbeans-8.2/cndext:/usr/local/netbeans-8.2/dlight:/usr/local/netbeans-8.2/groovy:/usr/local/netbeans-8.2/extra:/usr/local/netbeans-8.2/javacard:/usr/local/netbeans-8.2/javafx: -Dnetbeans.home=/usr/local/netbeans-8.2/platform -Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade -Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense -Xmx400m -client -Xss2m -Xms32m -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.java2d.noddraw=true -Dsun.java2d.dpiaware=true -Dsun.zip.disableMemoryMapping=true -DaddExports:java.desktop/sun.awt=ALL-UNNAMED -DaddExports:java.base/jdk.internal.jrtfs=ALL-UNNAMED -DaddExports:java.desktop/java.awt.peer=ALL-UNNAMED -DaddExports:java.desktop/com.sun.beans.editors=ALL-UNNAMED -DaddExports:java.desktop/sun.awt.im=ALL-UNNAMED -DaddExports:java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED -DaddExports:java.management/sun.management=ALL-UNNAMED -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/acaeris/.netbeans/8.2/var/log/heapdump.hprof -splash:/home/acaeris/.cache/netbeans/8.2/splash.png org.netbeans.Main --cachedir /home/acaeris/.cache/netbeans/8.2 --userdir /home/acaeris/.netbeans/8.2 --branding nb
acaeris   9635  0.2  7.4 1031136 151764 ?      Sl   10:13   0:02 nodejs --harmony /home/acaeris/.netbeans/8.2/nbts-services.js
acaeris  10026  0.0  0.0  14224   940 pts/0    S+   10:33   0:00 grep --color=auto netbeans

但由于某种原因,Netbeans 无法在 /var/www 中创建文件夹,而且我也不能在控制台中不使用 sudo。我错过了什么?

【问题讨论】:

【参考方案1】:

所以我忘记了重启的关键步骤。虽然我加入了小组,但我目前没有登录,在小组中。

【讨论】:

以上是关于Linux 组权限混淆的主要内容,如果未能解决你的问题,请参考以下文章

Linux04(组管理和组权限管理权限操作)

Linux文件目录权限

Linux组管理和权限管理

[Linux之权限管理⽤户组管理]

Linux用户权限管理和组管理相关命令

Linux权限与组