Thread: Newbie Questions

Newbie Questions

From
Redefined Horizons
Date:
I'm running the latest stable version of PostgreSQL on a Debian Linux box running Gnome 2.0. I've just started setting up my first database with PostgreSQL and I've got a few newbie questions:
 
[1] Is there a way to determine where all the parts of my defualt PostgreSQL installation are located?
 
[2] Can I use the "SU" command to log in as Postgres if I am logged in as a non-root user, or is this only possible as the root user?
 
[3] How do I find the Postgres user's home directory, and what is kept there? (This may be answered as a part of the response to #1....)
 
[4] How do I ensure that the Postmaster server process is started when I reboot my machine?
 
[5] When I'm in PgAdmin III, does it matter if I add a new server as a non-root user, as the root-user, or as the Postgres user? What is the difference between the 3?
 
[6] If I forgot the Postgres user password, do I have to reinstall PostgreSQL to reset it, or can I do this somewhere else?
 
Thanks for any help with these questions.
 
Scott Huey

Re: Newbie Questions

From
"Guy Rouillier"
Date:
Changed your email format from HTML to plain text, which is preferred on
most mailing lists.

Redefined Horizons wrote:
> I'm running the latest stable version of PostgreSQL on a Debian Linux
> box running Gnome 2.0. I've just started setting up my first database
> with PostgreSQL and I've got a few newbie questions:
>
> [1] Is there a way to determine where all the parts of my defualt
> PostgreSQL installation are located?

Unless you told it otherwise, it should all be installed in
/usr/local/pgsql/bin.  I don't run Debian, so I don't know if it changes
things around.

>
> [2] Can I use the "SU" command to log in as Postgres if I am logged
> in as a non-root user, or is this only possible as the root user?

That's not really a PostgreSQL question, but rather a Unix question.
The answer is yes, assuming you know the password for the Postgres
userid.

>
> [3] How do I find the Postgres user's home directory, and what is
> kept there? (This may be answered as a part of the response to
> #1....)

Again, a Unix question.  Look in /etc/passwd, the home directory is
identified there.

>
> [4] How do I ensure that the Postmaster server process is started
> when I reboot my machine?

If you just want to see if it is running after the system is booted,
then use "ps -ef | grep postmaster".  If you want to configure your
system to ensure that it will start up on reboot, then you need to add
it to the init tasks.  How that is done depends on your particular
distribution, and again I don't know Debian.  You may have a GUI to
assist with that, but typically it amounts to including a symlink in
/etc/rc3.d to /etc/init.d.  I use Gentoo which is a whole different bowl
of fish.

>
> [5] When I'm in PgAdmin III, does it matter if I add a new server as
> a non-root user, as the root-user, or as the Postgres user? What is
> the difference between the 3?

You're not adding a new server to your PostgreSQL server, you are only
adding a new list item to PgAdmin, pointing to a hopefully existing
PostgreSQL server.  This list will only be visible to the userid you
used to create it.  In other words, standard Unix conventions apply:
each user has his/her own set of settings.

>
> [6] If I forgot the Postgres user password, do I have to reinstall
> PostgreSQL to reset it, or can I do this somewhere else?

If you leave everything installed via the defaults, you don't need any
password to log in locally.  So if you forget the password, you can log
in locally with no password and reset it.

>
> Thanks for any help with these questions.
>
> Scott Huey



--
Guy Rouillier

Re: Newbie Questions

From
Douglas McNaught
Date:
Redefined Horizons <redefined.horizons@gmail.com> writes:

> I'm running the latest stable version of PostgreSQL on a Debian Linux box
> running Gnome 2.0. I've just started setting up my first database with
> PostgreSQL and I've got a few newbie questions:

I'm going to assume you installed the Debian packages rather than
installing from source...

> [1] Is there a way to determine where all the parts of my defualt
> PostgreSQL installation are located?

$ dpkg -l "postgresql*"

Then for each package listed, do

$ dpkg -L <packagename>

> [2] Can I use the "SU" command to log in as Postgres if I am logged in as
> a non-root user, or is this only possible as the root user?

If you give the postgres user a Unix password (as root) using the
'passwd' command, you should be able to 'su' to that user from any
account.

> [3] How do I find the Postgres user's home directory, and what is kept
> there? (This may be answered as a part of the response to #1....)

Look at the user's entry in '/etc/passwd'.

> [4] How do I ensure that the Postmaster server process is started when I
> reboot my machine?

It should be automatically started if you installed the Debian packages.

> [5] When I'm in PgAdmin III, does it matter if I add a new server as a
> non-root user, as the root-user, or as the Postgres user? What is the
> difference between the 3?

Never used it, sorry.

> [6] If I forgot the Postgres user password, do I have to reinstall
> PostgreSQL to reset it, or can I do this somewhere else?

If you're talking about the Unix password, root can change any
password.  If you're talking about the PG password, you can edit
the ph_hba.conf file to allow 'postgres' to connect without a
password, then go into 'psql' and change the password with ALTER USER.
See the docs for more info on this part.

-Doug

Re: Newbie Questions

From
Oliver Elphick
Date:
On Fri, 2005-10-21 at 19:46 -0400, Douglas McNaught wrote:
> Redefined Horizons <redefined.horizons@gmail.com> writes:
>
> > I'm running the latest stable version of PostgreSQL on a Debian Linux box
> > running Gnome 2.0. I've just started setting up my first database with
> > PostgreSQL and I've got a few newbie questions:
>
> I'm going to assume you installed the Debian packages rather than
> installing from source...

...and if you did install from source, they're wherever you put them (as
I frequently tell my daughter)...

The real configuration files for the Debian packages are stored
in /etc/postgresql and /etc/postgresql-common.  There are symbolic links
to those locations in the database directories.

...
> > [2] Can I use the "SU" command to log in as Postgres if I am logged in as
> > a non-root user, or is this only possible as the root user?
>
> If you give the postgres user a Unix password (as root) using the
> 'passwd' command, you should be able to 'su' to that user from any
> account.

But generally that is thought to be inadvisable from a Unix security
point of view, because it also allows anyone to log in as postgres
without your knowing their real identity.  You can use sudo to execute a
command as another user, and then only your own password is needed.

...
> > [4] How do I ensure that the Postmaster server process is started when I
> > reboot my machine?
>
> It should be automatically started if you installed the Debian packages.

If you didn't, look in contrib for an example of an init script.  On
Debian, this should be put into /etc/init.d and then you should use
update-rc.d to set up the links for the runlevels in which you want it
to run.

> > [5] When I'm in PgAdmin III, does it matter if I add a new server as a
> > non-root user, as the root-user, or as the Postgres user? What is the
> > difference between the 3?
>
> Never used it, sorry.

PgAdmin is a client application, so setting up a server means telling
PgAdmin where to find the server you want to connect to.  You should do
it as the user who is going to be using PgAdmin.

...

You do not generally need to use the postgres username; you can set up
your own username as a PostgreSQL superuser and then you can do anything
that postgres can do (except access the Unix files from outside a
database connection).

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html