Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 14639  / 2 Years ago, wed, september 7, 2022, 9:49:16

I installed postgres under Lubuntu 13.04. When I try to run it:



sudo -u postgres psql


it gives me this error:



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


I can start it changing the port:



sudo -u postgres -i
export PGPORT=5433
psql


but I would to make it the default port. I tried to add export PGPORT=5433 to the .bashrc of postgres user, but it doesn't work; it seems that .bashrc is not executed with sudo -u, since if I do:



sudo -u postgres -i
. .bashrc
psql


it works.



Is there a way to make sudo -u USER -i execute .bashrc, or is there another way to make the change of that environment variable permanent for postgres user?


More From » lubuntu

 Answers
0

The sudoers(5) man page has a "Command Environment" section that reads, in part:




On Linux and AIX systems the contents of /etc/environment are also
included.



[#30634] Friday, September 9, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ticeate

Total Points: 497
Total Questions: 128
Total Answers: 112

Location: Samoa
Member since Fri, Nov 27, 2020
4 Years ago
;