Permission Denied on shared object (.so) file postgresql I'm trying to import a C-Language function to my postgresql database.

I have my shared object inside my home directory but I can't use it on my database.

CREATE OR REPLACE FUNCTION add_one(integer) RETURNS integer AS '/home/pedro/.../.../example.so', 'add_one' LANGUAGE C STRICT;


And this is my error message:

ERROR:  could not access file "/home/pedro/.../.../example.so": Permission denied


I think is probably my OS blocking access to this file but I don't want to give permission to all users.

tl;dr: I'm looking for a elegant solution to import my C-Language Function, as a Shared Object file, inside my postgresql database.

Thanks in advance!
Permissions on the path and file should be postgres:postgres.

ls -l /home/pedro/.../.../example.so
chown -R postgres: /home/pedro/.../.../


You will probably need sudo for changing the file ownership.