[GENERAL] Running postgres with a different user/group

2010-11-03 Thread Gabriele Bulfon
Hi,
I installed latest postgres from sources inside a custom environment of mine.
This environment runs various services, all under a common user/group.
I need to run postgres under the same user/group, witout having to create and 
use postgres user.
I could do it, and postgres starts.
But now I can't seem to connect to the database, because it says:
FATAL:  role postgres does not exist
How can I let postgres run under my own user instead of postgres?
I can rebuild from sources, if needed.
Thanx,
Gabriele.
-= Mail sent through WebTop2 =-


Re: [GENERAL] Running postgres with a different user/group

2010-11-03 Thread Raymond O'Donnell

On 03/11/2010 10:29, Gabriele Bulfon wrote:

Hi,
I installed latest postgres from sources inside a custom environment of
mine.
This environment runs various services, all under a common user/group.
I need to run postgres under the same user/group, witout having to
create and use postgres user.
I could do it, and postgres starts.
But now I can't seem to connect to the database, because it says:

FATAL: role postgres does not exist

How can I let postgres run under my own user instead of postgres?
I can rebuild from sources, if needed.


Roles, or database users, are nothing whatever to do with operating 
system users. The error you're getting is that the role under which 
you're trying to connect doesn't exist within the PostgreSQL cluster.


Just specify the role when you're connecting - e.g., if using psql, do 
something like this:


  psql -U role database

HTH,

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie

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


Re: [GENERAL] Running postgres with a different user/group

2010-11-03 Thread Gabriele Bartolini
Hi Gabriele,

On Wed, 3 Nov 2010 11:29:25 +0100 (CET), Gabriele Bulfon
gbul...@sonicle.com wrote:
 I need to run postgres under the same user/group, witout having to
create
 and use postgres user.

That's reasonable and perfectly doable with Postgres.

 But now I can't seem to connect to the database, because it says:
 FATAL:  role postgres does not exist
 How can I let postgres run under my own user instead of postgres?

That means that PostgreSQL is successfully running. Try and connect to the
database using a different user by passing the '-U' option to psql or by
setting the PGUSER environment variable.

 I can rebuild from sources, if needed.

I believe there is no need to do that.

Ciao,
Gabriele
-- 
 Gabriele Bartolini - 2ndQuadrant Italia
 PostgreSQL Training, Services and Support
 gabriele.bartol...@2ndquadrant.it - www.2ndQuadrant.it

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


Re: [GENERAL] Running postgres with a different user/group

2010-11-03 Thread Gabriele Bartolini
Hi Gabriele,

   I forgot to mention one thing.

 That means that PostgreSQL is successfully running. Try and connect to
the
 database using a different user by passing the '-U' option to psql or by
 setting the PGUSER environment variable.

PostgreSQL creates a role/user inside the cluster with the same name as
the user that ran initdb.

Try and connect to either the postgres or the template1 database, by
executing:

psql template1

or

psql postgres

and then type:

\du

This will give you a list of the roles (users) inside the database.

Please make sure you specify the right port and host (or Unix socket) to
psql.

Ciao,
Gabriele

-- 
 Gabriele Bartolini - 2ndQuadrant Italia
 PostgreSQL Training, Services and Support
 gabriele.bartol...@2ndquadrant.it - www.2ndQuadrant.it

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


Re: [GENERAL] Running postgres with a different user/group

2010-11-03 Thread Gabriele Bulfon
Thanx guys, all of your solutions are fine, but I could manage it in a 
different manner.
Modified the ident map file to map my special system user to postgres, so I 
don't have to
specify the postgres user any more ;)
Thanx!
Gabriele.
-= Mail sent through WebTop2 =-
--
Da: Gabriele Bartolini
A: Gabriele Bartolini
Cc: Gabriele Bulfon
pgsql-general@postgresql.org
Data: 3 novembre 2010 12.26.04 CET
Oggetto: Re: [GENERAL] Running postgres with a different user/group
Hi Gabriele,
I forgot to mention one thing.
That means that PostgreSQL is successfully running. Try and connect to
the
database using a different user by passing the '-U' option to psql or by
setting the PGUSER environment variable.
PostgreSQL creates a role/user inside the cluster with the same name as
the user that ran initdb.
Try and connect to either the postgres or the template1 database, by
executing:
psql template1
or
psql postgres
and then type:
\du
This will give you a list of the roles (users) inside the database.
Please make sure you specify the right port and host (or Unix socket) to
psql.
Ciao,
Gabriele
--
Gabriele Bartolini - 2ndQuadrant Italia
PostgreSQL Training, Services and Support
gabriele.bartol...@2ndquadrant.it - www.2ndQuadrant.it


Re: [GENERAL] Running postgres with a different user/group

2010-11-03 Thread Raymond O'Donnell

On 03/11/2010 11:43, Gabriele Bulfon wrote:

Thanx guys, all of your solutions are fine, but I could manage it in a
different manner.
Modified the ident map file to map my special system user to postgres,
so I don't have to
specify the postgres user any more ;)


Good stuff! Glad you got it to work.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie

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


Re: [GENERAL] running postgres

2009-02-05 Thread Sebastian Tennant
Quoth Kusuma Pabba kusu...@ncoretech.com:
 /usr/local/pgsql/bin/psql test
 test=#

 sudo su postgres -c psql template1
 template=#

 why is the path different in both cases?

Type:

 $ which psql

and 

 $ sudo which psql

The answer is the same, yes?

 $ /usr/local/pgsql/bin/psql test
   |___|
 |
   absolute path

 $ cd /usr/local/pgsql
 $ bin/psql test
   |__|
 |
  relative path

When you provide an absolute path (or a relative path), your shell does
not search your $PATH environment variable for the program - it just
runs the program in the directory you specified.

When you don't provide a path of any sort, your shell looks for the
program in the directories specified in your $PATH environment variable.

Check the value of your $PATH by typing:

 $ echo $PATH

If there is only one executable file called 'psql' in the directories in
your PATH, it makes no difference whether you specify a path, or no path
at all.

Note that different users may have different directories in their $PATH.
Your can alter your $PATH variable (if you need to) in your ~/.profile.

 what is the difference between the above two and,

'sudo command' is a command for running a single command with
superuser privileges, i.e., 'as root'.

'su user' (without the -c switch) is a command for 'becoming' user
until you type 'exit'.

'su user -c command' is similar to 'sudo' in that the single command
command is run as user.

If you type:

 $ su postgres -c psql template1

you will be asked for a password, and if you haven't setup any user
accounts and passwords in postgres you won't know what the password is,
and therefore you won't be able to connect.

This is why you need to type 'sudo su postgres -c psql template1'. sudo
temporarily makes you root, and root is never asked for passwords (root
is God in the UNIX world) so you are able to connect as user 'postgres'.

 how can i create a user in test or template?

 when i give create user it is asking for create role , how should i
 create role?

Others with a better understanding of users and roles should answer this
question.

Sebastian
-- 
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap


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


Re: [GENERAL] running postgres

2009-02-05 Thread Sam Mason
On Thu, Feb 05, 2009 at 08:12:48AM +, Sebastian Tennant wrote:
 This is why you need to type 'sudo su postgres -c psql template1'.

A little shortcut, you can do the above from sudo as:

  sudo -u postgres psql template1

This was pointed out to me by another kind soul on this list, but I
can't, for the life of me, remember who though!  Sorry

-- 
  Sam  http://samason.me.uk/

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


Re: [GENERAL] running postgres

2009-02-05 Thread Sam Mason
On Thu, Feb 05, 2009 at 12:05:31PM +0530, Kusuma Pabba wrote:
 how can i create a user  in test or template
 when i give create user
 it is asking for create role , how should i create role?

Users are associated with the cluster and not with any specific
database.  I tend to add users by directly entering the SQL, but, as
others have noted, there's a program called createuser that you can
use instead.  Only a few users can normally create new users (or roles
as they have recently been changed to) and you can see who by typing
\du into psql and looking for the Create role column.  Normally only
the database owner (i.e. the postgres user) can create new users by
default, which is probably where you got the su postgres command from.

Once you've logged in with somebody whose capable of creating users, you
need to type something like:

  CREATE USER furble;
  GRANT CONNECT ON DATABASE test TO furble;

This will create the user furble and allow them to connect to the
test database.  I believe it's generally preferable to use groups to
control permission and add users to groups rather than granting them
specific rights.  But use cases vary.  The manual pages for these things
are:

  http://www.postgresql.org/docs/current/static/user-manag.html
  http://www.postgresql.org/docs/current/static/sql-createrole.html
  http://www.postgresql.org/docs/current/static/sql-grant.html
  http://www.postgresql.org/docs/current/static/app-createuser.html

You will probably need to think about authentication, at which point the
following section will help:

  http://www.postgresql.org/docs/current/static/client-authentication.html

-- 
  Sam  http://samason.me.uk/

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


[GENERAL] running postgres

2009-02-04 Thread Kusuma Pabba


may this be a silly doubts but , i am new to postgres, please answer to 
these::


/usr/local/pgsql/bin/psql test
test=#


sudo su postgres -c psql template1
template=#


what is the difference between the above two and,
why is the path different in both cases
which should i use now


how can i create a user  in test or template
when i give create user
it is asking for create role , how should i create role?



Thanks  Regards
kusuma.p

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


Re: [GENERAL] running postgres

2009-02-04 Thread Schwaighofer Clemens
On Thu, Feb 5, 2009 at 15:35, Kusuma Pabba kusu...@ncoretech.com wrote:

 may this be a silly doubts but , i am new to postgres, please answer to
 these::

 /usr/local/pgsql/bin/psql test
 test=#


 sudo su postgres -c psql template1
 template=#


 what is the difference between the above two and,
 why is the path different in both cases
 which should i use now

first you connect to the database test

in the second one you run the command psql on the database template1

  -c COMMAND  run only single command (SQL or internal) and exit


 how can i create a user  in test or template
 when i give create user
 it is asking for create role , how should i create role?

you can create a user with createuser commandline tool or use the
CREATE ROLE sql command
(http://www.postgresql.org/docs/8.3/static/sql-createrole.html) and
then use the GRANT command
(http://www.postgresql.org/docs/8.3/static/sql-grant.html) to give the
user rights to the database you want. See the GRANT ... ON DATABASE
part for this.

-- 
[ Clemens Schwaighofer  -=:~ ]
[ IT Engineer/Manager]
[ E-Graphics Communications, TEQUILA\ Japan IT Group ]
[6-17-2 Ginza Chuo-ku, Tokyo 104-8167, JAPAN ]
[ Tel: +81-(0)3-3545-7703Fax: +81-(0)3-3545-7343 ]
[ http://www.tequila.jp  ]

Advertising Age Global Agency of the Year 2008
Adweek Global Agency of the Year 2008

This e-mail is intended only for the named person or entity to which 
it is addressed and contains valuable business information that is 
privileged, confidential and/or otherwise protected from disclosure.  
Dissemination, distribution or copying of this e-mail or the 
information herein by anyone other than the intended recipient, or 
an employee or agent responsible for delivering the message to the 
intended recipient, is strictly prohibited.  All contents are the 
copyright property of TBWA Worldwide, its agencies or a client of 
such agencies. If you are not the intended recipient, you are 
nevertheless bound to respect the worldwide legal rights of TBWA 
Worldwide, its agencies and its clients. We require that unintended 
recipients delete the e-mail and destroy all electronic copies in 
their system, retaining no copies in any media.If you have received 
this e-mail in error, please immediately notify us via e-mail to 
disclai...@tbwaworld.com.  We appreciate your cooperation.

We make no warranties as to the accuracy or completeness of this 
e-mail and accept no liability for its content or use.  Any opinions
expressed in this e-mail are those of the author and do not 
necessarily reflect the opinions of TBWA Worldwide or any of its 
agencies or affiliates. 


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


Re: [GENERAL] running postgres

2007-10-19 Thread Stephane Bortzmeyer
On Thu, Oct 18, 2007 at 10:50:02AM -0500,
 Scott Marlowe [EMAIL PROTECTED] wrote 
 a message of 18 lines which said:

 Personally, I found it quite easy.
 
 apt-get install postgresqlp8.2
 sudo /etc/init.d/postgres-8.2 start
 sudo su - postgres
 psql
 
 4 whole steps. 

Although I regard PostgreSQL as quite simple and easy to use (I find
it easier than MySQL, for instance), your oversimplication won't help
the potential users to evalute PostgreSQL. For instance, I typically
spend a lot of time in step 5, editing pg_hba.conf and struggling to
obtain the desired effect.

Also, on non-Debian platforms, step 1 can be more complicated if I
want other languages (I use Python a lot in my stored procedures).

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[GENERAL] running postgres

2007-10-18 Thread Ken Johansson
and i though PostgreSQL would be easier to get up and running than SQL
server

-- 
Ken


Re: [GENERAL] running postgres

2007-10-18 Thread brian

Ken Johansson wrote:

and i though PostgreSQL would be easier to get up and running than SQL
server



Question? Complaint? Thinking out loud? Lyrics to a song? We're all 
standing by, Ken!


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


Re: [GENERAL] running postgres

2007-10-18 Thread Scott Marlowe
On 10/18/07, Ken Johansson [EMAIL PROTECTED] wrote:
 and i though PostgreSQL would be easier to get up and running than SQL
 server

I sincerely hope you don't consider that the sole criteria for
choosing databases.

Personally, I found it quite easy.

apt-get install postgresqlp8.2
sudo /etc/init.d/postgres-8.2 start
sudo su - postgres
psql

4 whole steps.  I must be forgetting something there.

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] running postgres

2007-10-18 Thread Ken Johansson
Hello,

Sorry everyone for the stupid rant.  Wont happen again.  And thanks for
offer assistance.  I seem to have it running and once i have a valid
question ill post it.

Sorry again..

Ken


On 18/10/2007, brian [EMAIL PROTECTED] wrote:

 Ken Johansson wrote:
  and i though PostgreSQL would be easier to get up and running than SQL
  server
 

 Question? Complaint? Thinking out loud? Lyrics to a song? We're all
 standing by, Ken!

 ---(end of broadcast)---
 TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq




-- 
Ken


Re: [GENERAL] running postgres

2007-10-18 Thread Scott Marlowe
On 10/18/07, Ken Johansson [EMAIL PROTECTED] wrote:
 Hello,

 Sorry everyone for the stupid rant.  Wont happen again.  And thanks for
 offer assistance.  I seem to have it running and once i have a valid
 question ill post it.

Don't worry about it.  We've all had to cut our teeth sometime.  And
don't worry, it shouldn't take long before something truly puzzling
has you back on the lists.

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] running postgres

2007-10-18 Thread brian

Ken Johansson wrote:

Hello,

Sorry everyone for the stupid rant.  Wont happen again.  And thanks for
offer assistance.  I seem to have it running and once i have a valid
question ill post it.

Sorry again..

Ken



We'll put it down as thinking out loud then. It happens. ;-)

brian

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

  http://archives.postgresql.org/


Re: [GENERAL] running postgres

2007-10-18 Thread Richard Huxton

Scott Marlowe wrote:

On 10/18/07, Ken Johansson [EMAIL PROTECTED] wrote:

and i though PostgreSQL would be easier to get up and running than SQL
server


I sincerely hope you don't consider that the sole criteria for
choosing databases.


I don't know - it's put me off MS-SQL in a big way.

Not only don't they have an apt repository for Debian, they don't even 
have compile instructions on their site - gcc is throwing up all sorts 
of errors. Maybe I'll try on intel rather than ppc...


--
  Richard Huxton
  Archonet Ltd

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] running postgres

2007-10-18 Thread Jorge Godoy
Em Thursday 18 October 2007 14:57:27 brian escreveu:
 Ken Johansson wrote:
  Hello,
 
  Sorry everyone for the stupid rant.  Wont happen again.  And thanks for
  offer assistance.  I seem to have it running and once i have a valid
  question ill post it.
 
  Sorry again..
 
  Ken

 We'll put it down as thinking out loud then. It happens. ;-)

OK...  But was it harder or easier than MS SQL Server? :-)



-- 
Jorge Godoy  [EMAIL PROTECTED]


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] running PostGres without installing it

2006-08-08 Thread Merlin Moncure

On 8/6/06, jesus martinez [EMAIL PROTECTED] wrote:


Merlin, first all, thanks for taking time to
answer me.

- where do i have to find the tutorial you
said ? do you have the URL ?


http://pginstaller.projects.postgresql.org/silent.html


- i actually didnt try the silent-mode.
 because the regular installers i know not always
 publish their command-line options...
 where can i get them ?

finally, is it to much to ask you if you could
send to me the script-file of your installer ?
(if you cant i will understand)


don't work at that company anymore, sorry =)
merlin

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

  http://archives.postgresql.org


[GENERAL] running PostGres without installing it

2006-08-05 Thread jesus martinez
hello, how are you ?

i want to distribute a copy of PostGres to my clients.
they really dont know anything about installing
programs or
configurating remote RDBMS sql-servers,
so i dont want to give them the
official-PostGres-installer.exe
but my own installer.exe (win32) that:

1) install the PostGres's required files
2) modify the system as PostGres needs (registry,
paths, etc)
3) execute it as a process, not as a service (if it is
possible)
(it must run also on win98 machines)
4) enable the server in a port readed from an INI file
or
something like that.
5) delete the default super-user or change its
password
6) creates the tables-structure that my client-app
needs
7a) insert the data or
7b) copy db-files to hdd, assign them in PostGres and
make
them available via PostGres.
8) create the dbuser that will be used by clients-apps
9) assign that dbuser to my tables

all without any kind of user interaction.

- where can i get information about the required
information
(i mean: basic required files, registry changes, conf
files,
sql commands to do what i need) ?

- if this is not possible, may i call the default
PostGre's
installer in silent mode ? and if so, what are the
command-lines
to set the defaults settings ?

- can any of you help me in any of those tasks ?

thanks in advance,






__
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] running PostGres without installing it

2006-08-05 Thread Merlin Moncure

On 8/6/06, jesus martinez [EMAIL PROTECTED] wrote:

hello, how are you ?

i want to distribute a copy of PostGres to my clients.
they really dont know anything about installing
programs or
configurating remote RDBMS sql-servers,
so i dont want to give them the
official-PostGres-installer.exe
but my own installer.exe (win32) that:


I've done it, it's not to difficult.  In fact, if you check the
archives you might find a tutorial.  The hard part in windows is
launching a cmd process to initdb the database since it can't run as
administrator.  I had to use a program called 'sanur' to allow me to
feed the password to runas.

Also check out ntrights.exe to grant logon as service right and the
'net' command to add a user.

Have you looked at silent mode install with standard installer?

merlin

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly