Search Postgresql Archives

Re: starting postgresql with pgsql password - workarounds?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using the default startup script that is supplied with the FreeBSD port (/usr/local/etc/rc.d/010.pgsql.sh) and enabling it in /etc/rc.d with -o -i flags so listens on TCP/IP

Also, I should mention that the password I mentioned is NOT the password for the local (Unix) pgsql account, but the password I set for the postgresql database superuser, pgsql. That is the password I need to enter to get postgresql to start.

Thanks,
DW

---------------------------------------------------------------------------------
#!/bin/sh

# $FreeBSD: ports/databases/postgresql74-server/files/pgsql.sh.tmpl,v 1.17 2005/03/19 03:51:45 girgen Exp $
#
# PROVIDE: postgresql
# REQUIRE: LOGIN
# KEYWORD: FreeBSD shutdown
#
# Add the following line to /etc/rc.conf to enable PostgreSQL:
#
# postgresql_enable="YES"
# # optional
# postgresql_data="/usr/local/pgsql/data"
# postgresql_flags="-w -s -m fast"
#
# This scripts takes one of the following commands:
#
# start stop restart reload status initdb
#
# For postmaster startup options, edit ${postgresql_data}/postgresql.conf


prefix=/usr/local

. /etc/rc.subr

load_rc_config postgresql

# set defaults
postgresql_enable=${postgresql_enable:-"NO"}
postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
postgresql_user=pgsql
eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data"}
postgresql_class=${postgresql_class:-"default"}

name=postgresql
rcvar=`set_rcvar`
command=${prefix}/bin/pg_ctl
command_args="-D ${postgresql_data} ${postgresql_flags} $1"
extra_commands="reload initdb"
start_cmd="postgresql_command start"
stop_cmd="postgresql_command stop"
restart_cmd="postgresql_command restart"
reload_cmd="postgresql_command reload"
status_cmd="postgresql_command status"

initdb_cmd="postgresql_initdb"

postgresql_command()
{
su -l ${postgresql_user} -c "exec ${command} ${command_args}"
}
postgresql_initdb()
{
su -l -c ${postgresql_class} ${postgresql_user} -c "exec ${prefix}/bin/initdb -D ${postgresql_data}"
}


run_rc_command "$1"
-------------------------------------------------------------------------------------------------------------------------------------


Franco Bruno Borghesi wrote:

This is not a PostgreSQL problem, it's the script you are using for startup that has some problem. The pg_hba method is for connection stablishment. PostgreSQL will start no matter what you put there.

Startup scripts are usually run as root, and postgresql script should su to the postgresql user to start the database. I don't know what your script is doing, but root should be able to su to any user without password.

Check your script, post it if you want. It would be usefull to know what system you are using also (linux/bsd/solaris/etc).


2005/5/20, Duane Winner <duanewinner@xxxxxxx <mailto:duanewinner@xxxxxxx>>:


    hello,

    I've been using postgresql for about a year now, and am pretty
    comfortable with the basics, bu there has been something bugging
    me for
    a while now:

    I set the METHOD in pg_hba.conf to md5 so that a password is required
    from all users, from all hosts.

    The only problem is that if the server restarts, postgresql will not
    start until somebody goes to the console and enters the password
    for the
    pgsql account.

    Is there a solution for this solution?

    Thanks,
    DW

    ---------------------------(end of
    broadcast)---------------------------
    TIP 6: Have you searched our list archives?

                   http://archives.postgresql.org
    <http://archives.postgresql.org>




---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
     message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux