call initdb as regular user

Started by alexondiover 14 years ago8 messagesgeneral
Jump to latest
#1alexondi
alexondi@rambler.ru

Hi!
Can I call initdb with some params as regular user (not root or postgres)?
May I have some problem with replication, backup or with some other
subsystem?
Thank you!

--
View this message in context: http://postgresql.1045698.n5.nabble.com/call-initdb-as-regular-user-tp4712980p4712980.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#2Rodrigo Gonzalez
rjgonzale@estrads.com.ar
In reply to: alexondi (#1)
Re: call initdb as regular user

On 08/18/2011 03:20 PM, alexondi wrote:

Hi!
Can I call initdb with some params as regular user (not root or postgres)?

postgres is a normal user....so no problem at all.
initdb cannot be run as root

Show quoted text

May I have some problem with replication, backup or with some other
subsystem?
Thank you!

--
View this message in context: http://postgresql.1045698.n5.nabble.com/call-initdb-as-regular-user-tp4712980p4712980.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#3Peter Eisentraut
peter_e@gmx.net
In reply to: alexondi (#1)
Re: call initdb as regular user

On tor, 2011-08-18 at 11:20 -0700, alexondi wrote:

Can I call initdb with some params as regular user (not root or postgres)?

Sure.

#4John Cheng
johnlicheng@gmail.com
In reply to: alexondi (#1)
Re: call initdb as regular user

Sure you can. The initdb command just sets up the directory you
specified and that's all it does. The files in the directory will be
created with that user's permission. So the directory you specify must
be accessible to that "regular user".

man page - http://linux.die.net/man/1/initdb

"Creating a database cluster consists of creating the directories in
which the database data will live..."

Be warned - The files are created with the user's permissions, which
mean you need to now start the postgres process (i.e., pg_ctl or
postmaster) as the SAME user. If you ran initdb as a regular then try
to start the database as "postgres", the attempt might fail due to
permission denied errors.

So you can do it, but it might not be what you are trying to do. Any
reason why you want to use a user that is not "postgres" (assuming
postgres is a system user you created specifically for running
PostgreSQL database)

On Thu, Aug 18, 2011 at 11:20 AM, alexondi <alexondi@rambler.ru> wrote:

Hi!
Can I call initdb with some params as regular user (not root or postgres)?
May I have some problem with replication, backup or with some other
subsystem?
Thank you!

--
View this message in context: http://postgresql.1045698.n5.nabble.com/call-initdb-as-regular-user-tp4712980p4712980.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

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

--
---
John L Cheng

#5alexondi
alexondi@rambler.ru
In reply to: John Cheng (#4)
Re: call initdb as regular user

I have some single-purpose system and user can interact only with special
software (on computer would start only this software{daemon and gui},
postgresql and other system daemons). And I don't wont change user when I
call psql, pg_ctl, rsync and other stuff.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/call-initdb-as-regular-user-tp4712980p4713090.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#6John Cheng
johnlicheng@gmail.com
In reply to: alexondi (#5)
Re: call initdb as regular user

On Thu, Aug 18, 2011 at 11:59 AM, alexondi <alexondi@rambler.ru> wrote:

I have some single-purpose system and user can interact only with special
software (on computer would start only this software{daemon and gui},
postgresql and  other system daemons). And I don't wont change user when I
call psql, pg_ctl, rsync and other stuff.

In that case, as long as all the processes (your daemon, gui, and
PostgreSQL, rsync) are started under the same user account, you should
be fine.

--
---
John L Cheng

#7alexondi
alexondi@rambler.ru
In reply to: John Cheng (#6)
Re: call initdb as regular user

I call initdb with such params

*/opt/PostgreSQL/9.1/bin/initdb -D /projects/data_dir/data -E UTF-8 -U u*ser

after that create pg_log dir when I would create log (but why I must do this
step?)
change hba file and start database server with this command
/*opt/PostgreSQL/9.1/bin/pg_ctl start -w -D /projects/data_dir/data -l
/projects/data_dir/data/pg_log/startup.log*
Server was started but when I try connect to database I see in lgo such
messages
/FATAL: role "postgres" does not exist/
What is this? I use another user?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/call-initdb-as-regular-user-tp4712980p4714889.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

#8alexondi
alexondi@rambler.ru
In reply to: alexondi (#7)
Re: call initdb as regular user

sorry, my mistake when I connect to user I set login to "postgres"

--
View this message in context: http://postgresql.1045698.n5.nabble.com/call-initdb-as-regular-user-tp4712980p4714912.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.