473,770 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing the password of postres

Dear my friends...

I am using SuSE 9.1 and postgres 7.2.x .

Each time if I want to connect to postgres with
postgres I do like this:
"
patrixlinux@pat rix:~> su
Password:
patrix:/localhome/patrixlinux # su postgres
postgres@patrix :/localhome/patrixlinux> cd
postgres@patrix :~> psql kv
Welcome to psql 7.4.2, the PostgreSQL interactive
terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

kv=#
"

So now, the user "postgres" still has no password.
How can I create the password for the user with psql?

How can I create an account and its password with sql
query from psql? And how can I define that they have
the privilege to work with a database and some
tables....?

Thank you very much in advance.

_______________ _______________ ____
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #1
3 2174
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,

On Tue, 7 Sep 2004, Prabu Subroto wrote:
Each time if I want to connect to postgres with
postgres I do like this:
"
patrixlinux@pat rix:~> su
Password:
patrix:/localhome/patrixlinux # su postgres
postgres@patrix :/localhome/patrixlinux> cd
postgres@patrix :~> psql kv
Welcome to psql 7.4.2, the PostgreSQL interactive
terminal.
Or you could run this command with "any" user without su:

# psql kv -U postgres
So now, the user "postgres" still has no password.
How can I create the password for the user with psql?
ALTER USER will do it.

ALTER USER postgres WITH ENCRYPTED PASSWORD 'yourpassword';
(Don't forget the quotes...)

Also, you must enable password auth:

http://www.postgresql.org/docs/curre...ntication.html
http://www.postgresql.org/docs/curre...LE-PG-HBA.CONF

Then reload postgresql...
How can I create an account and its password with sql
query from psql?
CREATE USER username WITH ENCRYPTED PASSWORD 'yourpassword';

See \h CREATE USER in psql for details.
And how can I define that they have
the privilege to work with a database and some
tables....?


See the SQL keyword GRANT .

http://www.postgresql.org/docs/7.4/s...sql-grant.html

Regards,
- --
Devrim GUNDUZ
devrim~gunduz.o rg devrim.gunduz~l inux.org.tr
http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBPZaFtl8 6P3SPfQ4RAoPXAJ sGtWfePMGM6TwQN xHMJNGO/kd81wCfcyiA
KTiehpw329znOng 2CgteNc0=
=zOVs
-----END PGP SIGNATURE-----

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

http://archives.postgresql.org

Nov 23 '05 #2
Dear Gunduz....

It's solved now. Thank you very much for your help.

But I still have one question...

How can I grant privilege to a user on all tables
under a database.

for example the database name is "kv".
What I need is something like this:
"
create user sven with password 'his_password';
grant all on kv.* to sven;
"

Please tell me.

Thank you very much.
--- Devrim GUNDUZ <de****@gunduz. org> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,

On Tue, 7 Sep 2004, Prabu Subroto wrote:
Each time if I want to connect to postgres with
postgres I do like this:
"
patrixlinux@pat rix:~> su
Password:
patrix:/localhome/patrixlinux # su postgres
postgres@patrix :/localhome/patrixlinux> cd
postgres@patrix :~> psql kv
Welcome to psql 7.4.2, the PostgreSQL interactive
terminal.
Or you could run this command with "any" user
without su:

# psql kv -U postgres
So now, the user "postgres" still has no password.
How can I create the password for the user with

psql?

ALTER USER will do it.

ALTER USER postgres WITH ENCRYPTED PASSWORD
'yourpassword';
(Don't forget the quotes...)

Also, you must enable password auth:

http://www.postgresql.org/docs/curre...ntication.html http://www.postgresql.org/docs/curre...LE-PG-HBA.CONF
Then reload postgresql...
How can I create an account and its password with sql
query from psql?


CREATE USER username WITH ENCRYPTED PASSWORD
'yourpassword';

See \h CREATE USER in psql for details.
And how can I define that they have
the privilege to work with a database and some
tables....?


See the SQL keyword GRANT .

http://www.postgresql.org/docs/7.4/s...sql-grant.html
Regards,
- --
Devrim GUNDUZ
devrim~gunduz.o rg devrim.gunduz~l inux.org.tr
http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBPZaFtl8 6P3SPfQ4RAoPXAJ sGtWfePMGM6TwQN xHMJNGO/kd81wCfcyiA KTiehpw329znOng 2CgteNc0=
=zOVs
-----END PGP SIGNATURE-----



_______________ _______________ ____
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

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

Nov 23 '05 #3
On Tue, 2004-09-07 at 12:35, Prabu Subroto wrote:
Dear Gunduz....

It's solved now. Thank you very much for your help.

But I still have one question...

How can I grant privilege to a user on all tables
under a database.

for example the database name is "kv".
What I need is something like this:
"
create user sven with password 'his_password';
grant all on kv.* to sven;
"
This came up yesterday. The list archives aren't up to date so I repeat
what I wrote then. This mail was to explain a set of commands which
will do what you want. Please note that if you anticipate adding a
number of users with the same privileges, it would be much better to
create a group, run these commands (with appropriate alterations) to
give access to the group and simply add users to the group rather than
giving them access individually.
From yesterday: how can I gave a user full access (SELECT, INSERT,...) to a database
that he doesn't own? I used google to find a solution and I find a
Statement[1] that will the do the trick. But it looks very cryptical to me. B-) What does this statement do?
\a
This is a psql directive to turn off output alignment.
\t
Don't show column headers or the row count
\o /tmp/grant.sql
Redirect output to the named file
SELECT 'GRANT ALL ON ' || n.nspname || '.' || c.relname ||
' TO joe;'
FROM pg_catalog.pg_c lass AS c
LEFT JOIN pg_catalog.pg_n amespace AS n
ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','v','S') AND
n.nspname NOT IN ('pg_catalog', 'pg_toast') AND
pg_catalog.pg_t able_is_visible (c.oid)
ORDER BY n.nspname, c.relname;
Read the system catalog for a list of relations and construct a GRANT
command for each one to give ALL access to user joe. The output looks
like this:

GRANT ALL ON prod.address TO joe;
GRANT ALL ON prod.address_id _seq TO joe;
GRANT ALL ON prod.address_te lephone TO joe;
GRANT ALL ON prod.area TO joe;
...

and is written into the file /tmp/grant.sql as directed earlier.
\o
Stop sending output to the file.
\i /tmp/grant.sql


Run the output file as a script, thus granting the permissions to joe.

--
Oliver Elphick ol**@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
=============== =============== ==========
"For whosoever shall call upon the name of the Lord
shall be saved." Romans 10:13
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3852
by: ecPunk | last post by:
Hi, We have a web application where we want a user to be able to change his/her password if the password has expired but we are unable to do this with ASP (at the moment) because we can't log the user into the database without a valid password. We do not want to store any "admin" user info to connect to the database to change the users password for security issues. Does anyone have any ideas of how we could go about doing this? Any...
1
6232
by: patrickshroads | last post by:
I just started a new job and no one seems to know the SA password. Here's my plan to change it: 1. I've run a trace for a couple of days to verify that there are no jobs or processes that are connecting as SA and that would break if I changed the password. 2. Before the changing the password I am going to bulk copy out the sysxlogins row for SA so that if things go wrong I can reinset the old data with the old unknown password (will...
1
4290
by: Mindy Geac | last post by:
Hello, I'm seaching for the possibility to change Domain/User passwords. And a check for users if the password has to change with the first logon or when the password is expired. thanx, Mindy
1
1986
by: black lee via DBMonster.com | last post by:
we would like to provide users with changing password feature in our application. I understand that db2 uses password of operating systems. does anyone know if there is sql commend or api we use in our application to change password? thanks. We are using DB2V8.2 Express Edition V8.2, and ODBC Driver is IBM DB2 ODBC Driver. our application is C application. -- Message posted via http://www.dbmonster.com
10
9888
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
4
1765
by: muchexie | last post by:
I have developed a login system but its failing to allow the user to change password. Here is my code. <? require_once("system_fns.php"); session_start(); do_html_header("Changing password"); check_valid_user(); $new_passwd=($HTTP_POST_VARS); $new_passwd2=($HTTP_POST_VARS);
4
4325
by: Renilkumar | last post by:
Hi, We have developed a .net2.0 application using asp.net, vb.net and oracle9i. From the appl. we pass the datasource=;userid=;password=; to validate the username and password against the user_users table in oracle. When the password is expired, We are forcing the user to change the password through a screen which uses... ALTER USER <user> IDENTIFIED BY <newpassword> REPLACE <oldpassword> But the moment this statement excecute in the...
4
4897
by: John Kotuby | last post by:
Hi all, I have a simple user-form which accepts contact and profile information for the user to edit and save. All the textboxes are working fine and displaying the expected data, both when the screen is first displayed and after a save of changed data. The text boxes are being populated during the Page_Load event. However, when I change the TextMode property to PassWord, as I have 2 password textboxes (one for confirmation) no data...
0
1434
by: =?Utf-8?B?RWQgT3R0bw==?= | last post by:
When changing a user's password in Active Directory Users... I get a strange error message (and the password change fails): Windows can not complete the password change for the user <insert user name> because: The system can not find the file specified. Also can not add users. However: NO EVENTS are being generated associated with this message in any
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.