0

I have installed postgreSql client 9.6 following this link postgreSql installation and I am using centos version 7 on Linux.

It got installed successfully but I am getting some problems while accessing that.

I try this.

[xyz@innolx20122 ~]$ su - postgres
Password:

which password need to enter here? I tried postgres which is not working.

I tried this also.

[xyz@innolx20122 ~]$ sudo -u postgres psql
[sudo] password for xyz:
could not change directory to "/home/xyz": Permission denied
psql (9.6.19)
Type "help" for help.

I was able to enter using my password. Is this the right way to enter postgres?

I saw many links on this but I am getting confused finally.

3 Answers 3

1

The home directory of the user xzy is not readable by user postgres, but you start the psql command from there. As a result, you get *permission deny *. Change the directory to some other place before running the sudo:

 cd /
 sudo -u postgres psql
1

Please do this from root account. So first become root user:

$ sudo -i
# 

and then:

# su - postgres
0
0

Step 1

stat -c "%G" .

Step 2

sudo usermod -aG <the output from the step 1> postgres

df.tips/t/2063/2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .