From: | David <dbree(at)duo-county(dot)com> |
---|---|
To: | operationsengineer1(at)yahoo(dot)com |
Cc: | "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Switch to Linux Dev Questions |
Date: | 2006-05-06 21:21:25 |
Message-ID: | 20060506212125.GA1333@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Sat, May 06, 2006 at 08:27:09AM -0700, operationsengineer1(at)yahoo(dot)com wrote:
> > On 5/6/06, operationsengineer1(at)yahoo(dot)com
> > <operationsengineer1(at)yahoo(dot)com> wrote:
> > > hi all,
> > Hello again!
> > > why do i have to su to root before i su to postgres (in order to
> > > run psql)? i tried to su from my username and it asked for a
> > > password and said authentication failed - there is no password.
> > For security reasons service-accounts are commonly password-less,
> > and the account disabled. Usually one achieves that with a passwd
> > -l <account> That way only root is able to switch to that user if it
> > is (for some reason) required.
> thanks for the explanations. it makes sense now. no
> password means one must login from root to protect the
> account.
This question has been answered quite well. However, to take it one
step further, if you want to get a bit fancy, you can su from the user
straight to postgres in one command thus:
su -c 'su postgres -c "psql blah"'
Then, when you exit psql, you drop straight back to the user instead of
root. Do note that you may have to watch out for quoting perhaps
escaping the quotes if you need quotes in the command (where I used
"psql blah"), since both the single and double quotes are being used.
Bruno Wolfe suggested using the -U option for psql, but I use 'ident
sameuser' authentication for postgres, and the -U method doesn't work
for me.
> > > also, i tried help in psql and when i got to the
> > end,
> > > i was stuck. there was no intuitive way to get
> > out.
> > > i just saw END with no way to do anything - i
> > closed
> > > the session and started again.
> > \q ... it may not be "intuitive", but it's
> > well-documented.
>
> actually, it wouldn't let me type anything. i believe
> i tried \q b/c i am aware of it, but nothign would
> type over the END that was displayed on the shell.
>
> if it happens again, i will type \q and see if i just
> missed it last time.
Actually, in this case, you're in a pager ('less' or 'more' probably)
and you simply type "q" to exit the pager. If I try "\q", it beeps on
the "\" but then exits on the "q". This is the case also (at least the
way my system is set up) when you're displaying a select query when it's
more than one screen long. pressing SPACE or PAGE DOWN (probably) will
scroll down one screen, pressing "b" or PAGE UP (probably) will scroll
up - well, if you are not familiar with the pager, find out what pager
is being used (probably "less") and check the manpage for it. There
are several features that you will find useful. You might even try "man
pager". There are several pagers and many distributions use a default
name "pager" which acts as sort of an alias for the actual pager you
use.
From | Date | Subject | |
---|---|---|---|
Next Message | David | 2006-05-06 21:58:47 | Re: postgres db deleted and recreated... "No directory, logging in with HOME=/" error... |
Previous Message | Devrim GUNDUZ | 2006-05-06 19:55:05 | Re: postgres db deleted and recreated... "No directory, |