我在TinyCore64机器上提供一个postgresql服务器,尽管我已经更改了所有内容的权限、所有权和组,但用户postgres仍然无法访问某些文件和文件夹。下面是命令和文件夹结构:
sudo -u postgres ls /etc/ssl/
# success
# Permissions: drwxr-xr-x 6 root root
sudo -u postgres ls /etc/ssl/private
# ls: cannot open directory /etc/ssl/private/: Permission denied
# Permissions: drwxr-xr-x 2 postgres postgres我很困惑。我做错了什么?
编辑:
贴出了准确的成绩单。
root@121e7b1cdaa4:~# sudo -u postgres ls -al /etc/ssl
total 28
drwxr-xr-x 6 root root 4096 Jun 12 08:33 .
drwxr-xr-x 161 root root 4096 Jun 12 08:33 ..
drwxr-xr-x 2 root root 4096 Jun 12 08:33 certs
-rw-r--r-- 1 root root 10835 May 2 20:29 openssl.cnf
drwxr-xr-x 2 postgres postgres 4096 Jun 12 08:33 private
root@121e7b1cdaa4:~# sudo -u postgres ls -al /etc/ssl/private/
ls: cannot open directory /etc/ssl/private/: Permission denied编辑:
发布了strace输出:
root@121e7b1cdaa4:~# strace -f sudo -u postgres ls -al /etc/ssl/private/
....
[pid 4270] close(3) = 0
[pid 4270] openat(AT_FDCWD, "/etc/ssl/private/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 EACCES (Permission denied)
[pid 4270] write(2, "ls: ", 4ls: ) = 4
[pid 4270] write(2, "cannot open directory /etc/ssl/p"..., 39cannot open directory /etc/ssl/private/) = 39
[pid 4270] write(2, ": Permission denied", 19: Permission denied) = 19
[pid 4270] write(2, "\n", 1
) = 1
....inode检查输出:
root@121e7b1cdaa4:/etc/ssl# sudo ls -ila /etc/ssl | grep private
19259 drwxr-xr-x 2 postgres postgres 4096 Jun 12 08:33 private
root@121e7b1cdaa4:/etc/ssl# sudo ls -ila /etc/ssl/private | egrep ' \.
19259 drwxr-xr-x 2 postgres postgres 4096 Jun 12 08:33 .发布于 2014-06-14 19:22:35
你确定是同一个目录吗?也就是同样的inode?您可以用这个结果来验证:
# sudo ls -ila /etc/ssl | grep private
# sudo ls -ila /etc/ssl/private | egrep ' \.我要尝试的另一件事是检查磁盘上是否存在inode问题。运行以下命令:# sudo touch /forcefsck然后,重新启动系统并让fsck运行。我要尝试的另一件事是检查磁盘上是否存在inode问题。运行以下命令:
A1
然后,重新启动系统并让fsck运行。
https://serverfault.com/questions/605186
复制相似问题