Search code examples
linuxpostgresqlntfs

Linux start PostgreSQL with other user


I have a NTFS drive mounted on linux. I want to move postgres data directory to that drive but when I try to start the service I get a 'FATAL: data directory .. has wrong ownership'

I know that this is happening because the owner of the data directory is me (my linux user) instead of the user postgres but I cannot change the ownership of the directory because of how the drive is mounted in the fstab file:

UUID=E8B4580DB457DC9E /mnt/Data ntfs defaults,uid=1000,gid=1000,rw 0 0
  • Tried adding my user the to postgres group but didn't work.

  • I also tried mounting the driver as follows:

    UID=E8B4580DB457DC9E /mnt/Data ntfs auto,users,permissions 0 0

I was able to change the ownership of the directory with this change but then the node packages were giving 'permission access' problem upon running or installation


Solution

  • Manage to solve it by creating a partition for the databases and mounting that partition with UID=E8B4580DB457DC9E /mnt/Data ntfs auto,users,permissions 0 0