Linux权限问题:"权限被拒绝"

时间:2014-06-14 18:39:40

标签: linux postgresql permissions

我在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
....

1 个答案:

答案 0 :(得分:0)

检查" / etc / ssl"的权限目录 - 似乎' postgres'您系统上的用户没有' rx'权利在某个目标的完整路径上。

应该像:

kaa@aknb5:~$ ls -l /etc/ |grep ssl
drwxr-xr-x  4 root root     4096 Jun 13 11:00 ssl
kaa@aknb5:~$ uname -a
Linux aknb5 3.2.0-61-generic-pae #93-Ubuntu SMP Fri May 2 21:46:08 UTC 2014 i686 i686 i386 GNU/Linux
kaa@aknb5:~$