Ubuntu: user postgres cannot access drive even after permissions and group membership are provided



Question:

I have been working on this for the better part of the morning. So I upgraded to ubuntu 14.04 last night, and that went smoothly. But there is an issue with the postgres user and access to my postgresql database data directory.

So the database folder is on a separate harddrive. When I mount the drive, the system mounts it to the /media/krishnab/{drive} folder as per the current udisks2 standard. So now the postgres user has to go through my home directory in order to get to the database folder.

I have included the postgres user in my krishnab group and also given the account a linux password. My home folder has "Me" (krishnab) as the owner and group krishnab. I have rebooted the pc a number of times too. However, whenever the postgres user tries to access the /media/krishnab folder there is always a permission denied error. I have also checked my /home/krishnab/ folder permissions to make sure they are good--krishnab is the group--and they are fine. I checked the permissions on the folder too and they are drwxrwxr-x+. So still no luck.

The only thing I noticed was that when I use the gnome-system-tools, I do not see the postgres user as a member of the krishnab group, but when I do sudo cat /etc/group I find that the only member of the krishnab group is krishnab:x:1000:postgres. So I am wondering why myself krishnab is no a member of my own group krishnab.

Any suggestions? I can't seem to figure out what I am missing. Thanks.


Solution:1

By any chance did you try to re-apply the permissions to /media/krishnab i.e. chmod -R /media/krsihnab? Wondering if the uid or gids are no longer the same.

http://manpages.ubuntu.com/manpages/dapper/man8/adduser.8.html

Mike


Solution:2

Ahh figured it out. Somehow there was an access control list on the folder /media/krishnab/, so I was able to just use the setfacl -m u:postgres:rwx /media/krishnab and that fixed it.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »