Thread: Proper Permissions for /usr/local/pgsql/data

Proper Permissions for /usr/local/pgsql/data

From
Rich Shepard
Date:
   I'm manually replacing -8.3.3 with -9.0.1 I have the old data/ directory
and pg_dumpall files safely stored. Following the directions at:
<http://www.postgresql.org/docs/current/static/install-upgrading.html>, step
#5 I see this:

postgres@salmo:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user
"postgres".
This user must also own the server process.

The database cluster will be initialized with locales
   COLLATE:  C
   CTYPE:    en_US
   MESSAGES: en_US
   MONETARY: en_US
   NUMERIC:  en_US
   TIME:     en_US
The default database encoding has accordingly been set to LATIN1.
The default text search configuration will be set to "english".

fixing permissions on existing directory /usr/local/pgsql/data ... initdb:
could not change permissions of directory "/usr/local/pgsql/data": Operation
not permitted

   The directory /usr/local/pgsql/data is owned by me; what should the
permissions be so I don't get that error message above?

TIA,

Rich

Re: Proper Permissions for /usr/local/pgsql/data

From
Dmitriy Igrishin
Date:
Hey Rich,

You should chown your data dir (/usr/local/pgsql/data) to "postgres"
before you run initdb.

2010/12/2 Rich Shepard <rshepard@appl-ecosys.com>
 I'm manually replacing -8.3.3 with -9.0.1 I have the old data/ directory
and pg_dumpall files safely stored. Following the directions at:
<http://www.postgresql.org/docs/current/static/install-upgrading.html>, step
#5 I see this:

postgres@salmo:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user
"postgres".
This user must also own the server process.

The database cluster will be initialized with locales
 COLLATE:  C
 CTYPE:    en_US
 MESSAGES: en_US
 MONETARY: en_US
 NUMERIC:  en_US
 TIME:     en_US
The default database encoding has accordingly been set to LATIN1.
The default text search configuration will be set to "english".

fixing permissions on existing directory /usr/local/pgsql/data ... initdb:
could not change permissions of directory "/usr/local/pgsql/data": Operation
not permitted

 The directory /usr/local/pgsql/data is owned by me; what should the
permissions be so I don't get that error message above?

TIA,

Rich

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
// Dmitriy.


Re: Proper Permissions for /usr/local/pgsql/data

From
Rich Shepard
Date:
On Thu, 2 Dec 2010, Dmitriy Igrishin wrote:

> You should chown your data dir (/usr/local/pgsql/data) to "postgres"
> before you run initdb.

   Thank you, Dmitriy. I thought that was the proper owner but wanted to
check first. This should be included in the document page on
installation/upgrading. When the new version is installed in a different
file system ownership information is not available.

Rich

Re: Proper Permissions for /usr/local/pgsql/data

From
Adrian Klaver
Date:
On Wednesday 01 December 2010 3:01:29 pm Rich Shepard wrote:
> On Thu, 2 Dec 2010, Dmitriy Igrishin wrote:
> > You should chown your data dir (/usr/local/pgsql/data) to "postgres"
> > before you run initdb.
>
>    Thank you, Dmitriy. I thought that was the proper owner but wanted to
> check first. This should be included in the document page on
> installation/upgrading. When the new version is installed in a different
> file system ownership information is not available.
>
> Rich

A couple of points.
1) From Step 5:
"Remember that you must execute these commands while logged in to the special
database user account "

To do the above the directory would need to be have permissions for the postgres
user.

2) From the beginning of the guide:
"These instructions assume that your existing installation is under
the /usr/local/pgsql directory, and that the data area is
in /usr/local/pgsql/data. Substitute your paths appropriately. "

The assumption is you are working off an existing install, so the ownership info
should already exist.

When in doubt, the best guide I have found is from the file INSTALL in the tar
ball. Add info above in upgrade case.

                               Short Version

./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

--
Adrian Klaver
adrian.klaver@gmail.com