Score:0

`chown postgres` of a subdirectory not working for a new disk

us flag

To give postgres more space, I mounted a ssd at: /mnt/fast_data/

What I'd like to accomplish is to give the postgres user ownership to the postgresql directory, so it doesn't say permission denied.

$ sudo chown -R root:root /mnt/fast_data/
$ sudo chown -R postgres:postgres /mnt/fast_data/postgresql/

When I test with:

su postgres

postgres@my_machine:  cd /mnt/fast_data/postgresql

I get the error=>>

bash: cd: /mnt/fast_data/postgresql: Permission denied

It does work when I chown -R postgres:postgres /mnt/fast_data giving ownership over the entire new drive. But surely there's a way to to only give access to the sub-directory. postgres has ownership over var/lib/postgres even though var/lib is owned by root. Am I missing something in regards to additional drives?

Additional requested info:

$ sudo ls -ld /mnt/fast_data /mnt/fast_data/postgresql
drwxrwx--- 3 main_user main_user 4096 Jul 22 00:18 /mnt/fast_data
drwxr-xr-x 6 postgres  postgres  4096 Jul 18 22:07 /mnt/fast_data/postgresql
$ mount | grep /mnt/fast_data
/dev/nvme0n1 on /mnt/fast_data type ext4 (rw,nosuid,nodev,relatime,x-gvfs-show)
zwets avatar
us flag
What file system is `/mnt/fast_data` and how is it mounted? Please add to your question the output of `ls -ld /mnt/fast_data /mnt/fast_data/postgresql` and `mount | grep /mnt/fast_data`, to check that permissions are set correctly.
v1z3 avatar
us flag
@zwets I added this ^^ info.
Score:4
us flag

The permissions on the /mnt/fast_data directory are drwxrwx---, meaning that user main_user and group main_user have full access (read, write, access), but all others have no permissions at all.

You need to chmod o+rx /mnt/fast_data so that its permissions become drwxrwxr-x, giving others the permission to see its contents and access it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.