OS환경 : Oracle Linux 7.6 (64bit)
DB 환경 : PostgreSQL 10
방법 : PostgreSQL 10 유저 superuser 권한, 롤 부여
psql 접속 후 유저 권한(롤) 확인
1 2 3 4 5 6 7 8 9 | $ psql psql (12.0) Type "help" for help. postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} |
신규 유저 scott 생성
1 2 3 4 5 6 7 8 | postgres=# create user scott; CREATE ROLE postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} scott | | {} |
해당 유저에게 postgres 유저와 같은 권한(롤) 부여 후 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | postgres=# alter user scott with superuser; ALTER ROLE postgres=# alter user scott with createdb; ALTER ROLE postgres=# alter user scott with createrole; ALTER ROLE postgres=# alter user scott with replication; ALTER ROLE postgres=# alter user scott with bypassrls; ALTER ROLE postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} scott | Superuser, Create role, Create DB, Replication, Bypass RLS | {} |
alter user 명령을 더 알고 싶으면 아래 명령 입력
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | postgres=# \h alter user Command: ALTER USER Description: change a database role Syntax: ALTER USER role_specification [ WITH ] option [ ... ] where option can be: SUPERUSER | NOSUPERUSER | CREATEDB | NOCREATEDB | CREATEROLE | NOCREATEROLE | INHERIT | NOINHERIT | LOGIN | NOLOGIN | REPLICATION | NOREPLICATION | BYPASSRLS | NOBYPASSRLS | CONNECTION LIMIT connlimit | [ ENCRYPTED ] PASSWORD 'password' | PASSWORD NULL | VALID UNTIL 'timestamp' ALTER USER name RENAME TO new_name ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] SET configuration_parameter { TO | = } { value | DEFAUL T } ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] SET configuration_parameter FROM CURRENT ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] RESET configuration_parameter ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] RESET ALL where role_specification can be: role_name | CURRENT_USER | SESSION_USER URL: https://www.postgresql.org/docs/12/sql-alteruser.html |
참조 :
'PostgreSQL > Admin' 카테고리의 다른 글
PostgreSQL 10 유저 Password_encryption 변경 (0) | 2020.02.24 |
---|---|
PostgreSQL 10, oracle fdw extension 으로 오라클 DB와 연결(dblink) 정리 (0) | 2019.11.27 |
oracle_utils.c:22:17: fatal error: oci.h: No such file or directory (0) | 2019.11.27 |
linux7.6에 PostgreSQL 10 + PG-Strom 2.2 GPU 사용 테스트 (0) | 2019.11.20 |
PostgreSQL 10 pg_dump 사용 테스트(40GB) (0) | 2019.10.30 |