Views of PostgreSQL user password and encrypted or unencrypted

Source: Internet
Author: User

Password_encryption = On
postgres=# create user user1 with encrypted password ' user1 ';
CREATE ROLE
postgres=# Create user user2 with unencrypted password ' user2 ';
CREATE ROLE
postgres=# Create user User3 with password ' user3 ';
CREATE ROLE
postgres=# select usename,passwd from Pg_shadow;
Usename | passwd
----------+-------------------------------------
Postgres |
User1 | Md57d1b5a4329b6478e976508ab9a49ee3d
User2 | User2
User3 | Md516bd93afc66e593f3aeedecdf1201ee6
(4 rows)
postgres=# select Rolname,rolpassword from Pg_authid;
Rolname | Rolpassword
----------+-------------------------------------
Postgres |
User1 | Md57d1b5a4329b6478e976508ab9a49ee3d
User2 | User2
User3 | Md516bd93afc66e593f3aeedecdf1201ee6
(4 rows)
The following two views show an encrypted password
postgres=# select usename,passwd from Pg_user;
Usename | passwd
----------+----------
Postgres | ********
User1 | ********
User2 | ********
User3 | ********
(4 rows)
postgres=# select Rolname,rolpassword from Pg_roles;
Rolname | Rolpassword
----------+-------------
Postgres | ********
User1 | ********
User2 | ********
User3 | ********
(4 rows)


Password_encryption = Off
postgres=# select usename,passwd from Pg_shadow;
Usename | passwd
----------+-------------------------------------
Postgres |
User1 | Md57d1b5a4329b6478e976508ab9a49ee3d
User2 | User2
User3 | Md516bd93afc66e593f3aeedecdf1201ee6
(4 rows)

postgres=# select Rolname,rolpassword from Pg_authid;
Rolname | Rolpassword
----------+-------------------------------------
Postgres |
User1 | Md57d1b5a4329b6478e976508ab9a49ee3d
User2 | User2
User3 | Md516bd93afc66e593f3aeedecdf1201ee6
(4 rows)

postgres=# select usename,passwd from Pg_user;
Usename | passwd
----------+----------
Postgres | ********
User1 | ********
User2 | ********
User3 | ********
(4 rows)

postgres=# Select Rolname,rolpassword from Pg_roles;
Rolname | Rolpassword
----------+-------------
Postgres | ********
User1 | ********
User2 | ********< br> User3 |
(4 rows)
postgres=# create user user4 with password ' user4 ';
Create ROLE
postgres=# create user User5 with encrypted password ' user5 ';
Create ROLE
postgres=# create user User6 with unencrypted password ' user6 ';
CREATE ROLE
postgres=# select usename,passwd from Pg_shadow;
Usename | passwd
----------+------------------- ------------------
Postgres |
User1 | Md57d1b5a4329b6478e976508ab9a49ee3d
User2 | user2
User3 | md516bd93afc66e593f3aeedecdf1201ee6
User4 | User4
User5 | md51dc34834df4da4804236eb250118fb41
User6 | User6
(7 rows)

postgres=# select Rolname,rolpassword from Pg_authid;
Rolname | Rolpassword
----------+-------------------------------------
Postgres |
User1 | Md57d1b5a4329b6478e976508ab9a49ee3d
User2 | User2
User3 | Md516bd93afc66e593f3aeedecdf1201ee6
User4 | User4
User5 | Md51dc34834df4da4804236eb250118fb41
User6 | User6
(7 rows)

postgres=# select usename,passwd from Pg_user;
Usename | passwd
----------+----------
Postgres | ********
User1 | ********
User2 | ********
User3 | ********
User4 | ********
User5 | ********
User6 | ********
(7 rows)

postgres=# select Rolname,rolpassword from Pg_roles;
Rolname | Rolpassword
----------+-------------
Postgres | ********
User1 | ********
User2 | ********
User3 | ********
User4 | ********
User5 | ********
User6 | ********
(7 rows)

postgres=# alter user postgres with password ' postgres ';
ALTER ROLE
postgres=# select usename,passwd from Pg_shadow;
Usename | passwd
----------+-------------------------------------
User1 | Md57d1b5a4329b6478e976508ab9a49ee3d
User2 | User2
User3 | Md516bd93afc66e593f3aeedecdf1201ee6
User4 | User4
User5 | Md51dc34834df4da4804236eb250118fb41
User6 | User6
Postgres | Postgres
(7 rows)

postgres=# alter user user1 with password ' pguser1 ';
ALTER ROLE
postgres=# select usename,passwd from Pg_shadow;
Usename | passwd
----------+-------------------------------------
User2 | User2
User3 | Md516bd93afc66e593f3aeedecdf1201ee6
User4 | User4
User5 | Md51dc34834df4da4804236eb250118fb41
User6 | User6
Postgres | Postgres
User1 | Pguser1
(7 rows)

Views of PostgreSQL user password and encrypted or unencrypted

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.