postgresqlchmod

Permission denied in postgres


I missed a bit with chmod and permissions. And now got a lot of problems with access to folders.

If I start server I see in browser:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

command

service --status-all

tells that postgres works

[ + ] postgresq works

Next I changed next files

sudo nano /etc/postgresql/9.5/main/postgresql.conf
#listen_addresses = 'localhost'

to

listen_addresses = 'localhost, server_ip, *'
sudo nano /etc/postgresql/9.5/main/pg_hba.conf

add

host    all         all         server_ip/24    trust

then command

psql -U postgres -h server_ip

and error

psql: could not connect to server: Connection refused
Is the server running on host "95.213.200.26" and accepting TCP/IP connections on port 5432?

The following chain of actions leads to a slightly different error

command

which psql

answer

/usr/bin/psql

sudo su - postgres

No directory, logging in with HOME=/

psql

psql: could not connect to server: Permission denied
Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Which file permissions do I have to change here?


Solution

  • This question is really hard. I made a great mistake with permissions 777 for / folder and whole system broke. So it is really easier delete server and start new project.