Linux,为什么我有组权限却不能写?
我想在我所属的员工组拥有的目录中创建一个文件。为什么我不能这样做?
bmccann@bmccann-htpc:~$ ls -l /usr/local/lib/R/
total 4
drwxrwsr-x 2 root staff 4096 2010-07-31 16:21 site-library
bmccann@bmccann-htpc:~$ id -nG bmccann
bmccann adm dialout cdrom plugdev staff lpadmin admin sambashare
bmccann@bmccann-htpc:~$ touch /usr/local/lib/R/site-library/tmp
touch: cannot touch `/usr/local/lib/R/site-library/tmp': Permission denied
I want to create a file in a directory owned by the staff group which I am a member of. Why can I not do this?
bmccann@bmccann-htpc:~$ ls -l /usr/local/lib/R/
total 4
drwxrwsr-x 2 root staff 4096 2010-07-31 16:21 site-library
bmccann@bmccann-htpc:~$ id -nG bmccann
bmccann adm dialout cdrom plugdev staff lpadmin admin sambashare
bmccann@bmccann-htpc:~$ touch /usr/local/lib/R/site-library/tmp
touch: cannot touch `/usr/local/lib/R/site-library/tmp': Permission denied
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您在进行组更改后是否注销并重新登录?请参阅:
涉及触摸权限失败的超级用户答案
Did you logout and log back in after making the group changes? See:
Super User answer involving touch permissions failure
我遇到了同样的问题,检查该文件夹是否有更多 ACL 规则!
如果您在列出文件夹时可以看到 +(加号),则意味着它具有特殊的访问规则。例如:
查看权限:
这意味着我的用户(user_in_apache_group)对该文件夹没有写权限。
解决方案是@techtonik所说的,为用户添加写权限:
再次检查权限:
希望有帮助。 ;)
I had the same issue, check if the folder has any more ACL rules or not!
If you can see + (plus sign) when you list folder, that means it has special access rules. For example:
View the permission:
So that means my user (user_in_apache_group) has no write permission for that folder.
The solution is what @techtonik said, add write permission for user:
Check permission again:
Hope it helps. ;)
为什么 Linux 用户不能编辑他所属组中的文件?
我使用的是 Ubuntu 12.04,并且遇到了同样的问题,即用户无法写入允许他进行组访问的文件。例如:
立即重新启动终端以确保用户
和组已生效。以 el 身份登录。
产生警告:
什么?我已经做了所有正确的事情,为什么它不起作用?
答案:
完全重新启动计算机。停止终端不足以解决这些问题。
我认为 apache2 也使用 www-data 组,因此该任务在某种程度上阻止了用户和组的正确执行。您不仅必须注销,还必须停止并重新启动使用您的组的任何服务。如果重新启动后仍无法解决问题,那么您就会遇到更大的问题。
Why can't Linux user edit files in group he is a part of?
I am using Ubuntu 12.04 and had the same problem where a user cannot write to a file to whom he is allowed group access to. For example:
Restart the terminal now to ensure the users
and groups have taken effect. Login as el.
Produces the Warning:
What? I've done everything right why doesn't it work?
Answer:
Do a full reboot of the computer. Stopping the terminal isn't enough to fix these problems.
I think what happens is apache2 also uses the www-data group, so the task was somehow preventing the users and groups from being enforced correctly. Not only do you have to logout, but you have to stop and restart any services that use your group. If a reboot doesn't get it, you've got bigger problems.
使用 Linux ACL(访问控制列表) - 它是权限系统的更细粒度版本,
它设置目录的活动权限和其中创建的任何内容的默认权限。
如果您刚刚将自己添加到
staff
组,则在不重新登录的情况下此操作将无法工作,但您可以仅为自己设置当前会话的权限。Use Linux ACL (access control lists) - it is more fine-grained version of permission system,
This sets both active rights for directory and default rights for anything created within.
This fails to work without relogin if you've just added yourself to the
staff
group, but you may set the permission only for yourself for the current session.我遇到了一个问题,即用户无法访问
/foo/bar/baz
目录,即使他有权限,因为他无权访问bar
目录。I had an issue when a user could not access the
/foo/bar/baz
directory even when he had permissions because he did not have an access to thebar
directory.也许你的硬盘已满。使用此命令查看“/dev/...”行。
Maybe your hard disk is full. use this command to check out the "/dev/..." rows.
在向该文件添加内容之前检查您的父目录是否有权限
Check if your parent directory have permission before you add content to that file