1

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 .
4
  • 5
    Did you turn on AppArmor or something? Jun 14, 2014 at 18:58
  • No, I've never used that before.
    – picardo
    Jun 14, 2014 at 19:12
  • No selinux either right? If you don't know, the answer is probably no since installing selinux on Ubuntu wasn't trivial IIRC. Just to be sure though, sudo ls -lZ /etc/ssl | grep private Jun 14, 2014 at 19:34
  • I don't think it has selinux either, but I realized something: this is not an Ubuntu machine. It's a TinyCore64 machine. (I was using a Vagrant box and completely zoned out on the machine distro.) I'm editing the post to reflect that.
    – picardo
    Jun 14, 2014 at 19:38

1 Answer 1

0

Are you sure it's the same directory? I.e., same inode? You could verify with the results of this:

# sudo ls -ila /etc/ssl | grep private
# sudo ls -ila /etc/ssl/private | egrep ' \.$'

Another thing I would try is checking the disk for inode issues. Run this:

# sudo touch /forcefsck

Then, reboot your system and let fsck run.

1
  • It seems like they are in the same inode. I am posting the output above.
    – picardo
    Jun 14, 2014 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .