use*_*668 23 linux permissions logging apache-2.2
我们有几个维护系统的开发人员,我希望他们能够轻松读取 /var/log/httpd 中的日志文件,而无需 root 访问权限。我为“其他”用户设置了读取权限,但是当我对日志文件运行 tail 时,我的权限被拒绝:
[root@ourserver httpd]# chmod -R go+r /var/log/httpd
[root@ourserver httpd]# ls -la
drwxr--r-- 13 root root 4096 Oct 25 03:31 .
drwxr-xr-x. 6 root root 4096 Oct 20 03:24 ..
drwxr-xr-x 2 root root 4096 Oct 20 03:24 oursite.com
drwxr-xr-x 2 root root 4096 Oct 20 03:24 oursite2.com
-rw-r--r-- 1 root root 0 May 7 03:46 access_log
-rw-r--r-- 1 root root 3446 Oct 24 22:05 error_log
[me@ourserver ~]$ tail -f /var/log/httpd/oursite.com/error.log
tail: cannot open `/var/log/httpd/oursite/error.log' for reading: Permission denied
Run Code Online (Sandbox Code Playgroud)
也许我遗漏了一些关于权限如何工作的内容,但我没有找到任何简单的答案。
Jos*_*ler 26
目录(如 /var/log/httpd)需要读取和执行权限才能被遍历。所以当你在目录中添加“r”时,它只允许世界看到内容,而不能进入它并继续进入其他目录。
尝试 chmod -R go+rX /var/log/httpd
| 归档时间: |
|
| 查看次数: |
21981 次 |
| 最近记录: |