I'm trying to install postgresql in the latest ubunutu, and I'm following these instructions. When I
sudo -u postgres psql postgres I get this error:
could not change directory to "/home/james"
I'd appreciate any help.
It sounds like the user postgres, which you are using to run psql, may not read the directory you are executing the statement from (/home/james/)
i'm guessing here, but i think sudo will open a new shell/environment in the current dir for postgres and execute psql there. If psql is not allowed to read the current dir, this error may occur.
try to switch the directory before executing the command:
I know this is old, but this question comes up highly-ranked on Google, and I prefer my answer. :)
Stick a -i in that sudo command - sudo also doesn't change the value of $HOME unless you do the -i command (which simulates an
Single quotes are important to that example, BTW. :)