PG_SHADOW is views its contains information about rolename and user password,user password validity,user connection limit and Role automatically inherits privileges of roles it is a member of,detailed information about user and privilege management.
Examples
--create the unencrypted user
--create the user with password validation time
--Describe the PG_SHADOW view
Name
|
Type
|
Description
|
usename
|
name
|
User name
|
usesysid
|
oid
|
ID of this user
|
usecreatedb
|
bool
|
User can create databases
|
usesuper
|
bool
|
User is a superuser
|
usecatupd
|
bool
|
User can update system catalogs. (Even a superuser cannot do this unless this column is true.)
|
passwd
|
text
|
Password (possibly encrypted); null if none. See pg_authid for details of how encrypted passwords are stored.
|
valuntil
|
abstime
|
Password expiry time (only used for password authentication)
|
useconfig
|
text[]
|
Session defaults for run-time configuration variables
|
postgres=# create user u2 WITH UNENCRYPTED PASSWORD 'u2'; CREATE ROLE
postgres=# CREATE USER u3 WITH PASSWORD 'u3' VALID UNTIL '2017-06-06'; CREATE ROLE
postgres=# \d PG_SHADOW View "pg_catalog.pg_shadow" Column | Type | Modifiers -------------+---------+----------- usename | name | usesysid | oid | usecreatedb | boolean | usesuper | boolean | usecatupd | boolean | userepl | boolean | passwd | text | valuntil | abstime | useconfig | text[] |
--list the user and show the users password and password validatation time
postgres=# select usename,usesysid,passwd,valuntil,useconfig from PG_SHADOW; usename | usesysid | passwd | valuntil | useconfig ----------+----------+-------------------------------------+------------------------+----------- postgres | 10 | md505ea766c2bc9e19f34b66114ace97598 | | rep | 24576 | md5df2c887bcb2c49b903aa33bdbc5c2984 | | u1 | 24583 | | | u2 | 24584 | u2 | | u3 | 24585 | md5dad1ef51b879799793dc38d714b97063 | 2017-06-06 00:00:00-04 | nijam | 24586 | | | (6 rows)
No comments:
Post a Comment