Skip site navigation (1) Skip section navigation (2)

Re: error on start up "could not change directory to"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Duffy <kevind0718(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: error on start up "could not change directory to"
Date: 2012-02-05 19:48:41
Message-ID: 18777.1328471321@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Kevin Duffy <kevind0718(at)gmail(dot)com> writes:
> I have found postings that talk about the difference between
> "su postgres"  vs  "su - postgres".  The dash (-) makes it a login shell
> But do understand the difference.  I suspect that, in my ignorance, I used
> su postgres

> So here is what happens when I start the server as follows:
>      /usr/bin/pg_ctl  -D  /usr/local/pgsql/data  start
> I get:
>    could not change directory to "/home/kbd"
>    server starting

> But the server starts OK.  Would like to fix the above issue.

That message happens if you execute the command while in a directory
that the postgres user can't read.  It's unsurprising that postgres
can't read your home directory, since mode 700 is typical for user home
directories on Linux.  What is surprising is that you are still cd'd
to your home directory when you do this.  One reason for recommending
"su -" and not just "su" is that the former should result in changing to
postgres' home directory.

BTW, if you're using a prepackaged version of postgres, which you
probably should be, this whole technique is inappropriate anyway.
You should be doing something like "sudo service postgresql start"
rather than invoking pg_ctl by hand.

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Kevin DuffyDate: 2012-02-05 22:56:18
Subject: Re: error on start up "could not change directory to"
Previous:From: Kevin DuffyDate: 2012-02-05 18:31:12
Subject: error on start up "could not change directory to"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group