I am provisioning a postgresql server on an TinyCore64 machine and there are some files and folders that cannot be accessed by the user postgres despite the fact that I have changed the permissions, ownership and group of everything. Here are the commands and the folder structure:
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
I am stumped. What am I doing wrong?
Edit:
Posted the exact transcript.
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
Edit:
posted the strace output:
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 check output:
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 .
Best Answer
Are you sure it's the same directory? I.e., same inode? You could verify with the results of this:
Another thing I would try is checking the disk for inode issues. Run this:
Then, reboot your system and let
fsck
run.