And*_*rao 25 postgresql user-permissions
我有一个用户:user_x在postgresql上拥有一个数据库,并且没有任何ROLE属性,如(CREATE_DB,SUPERUSER,...)
这个user_x可以访问整个数据库,创建表(在他的数据库上),选择,插入和更新数据.
我有这个数据库列表:
mydatabase=> \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-------------------------+----------+-----------+-----------+-------+-----------------------
postgres | postgres | SQL_ASCII | C | C |
mydatabase | user_x | UTF8 | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
whoami | postgres | SQL_ASCII | C | C |
(6 rows)
Run Code Online (Sandbox Code Playgroud)
以及以下角色:
mydatabase=> \du
List of roles
Role name | Attributes | Member of
-----------+-----------------------------------+-----------
postgres | Superuser, Create role, Create DB | {}
user_x | | {}
mydatabase=> \d
List of relations
Schema | Name | Type | Owner
--------+-----------------------------------+----------+----------
public | addresses | table | user_x
public | addresses_id_seq | sequence | user_x
public | assignments | table | user_x
public | assignments_id_seq | sequence | user_x
...
Run Code Online (Sandbox Code Playgroud)
好吧,直到我转储数据并将其恢复到另一个postgresql服务器上.
在另一台服务器(具有相同的数据库名称和用户)上导入数据并在psql上登录时,\ d命令回复:"找不到关系".
所以我在导入的数据库服务器上向user_x 添加了SUPERUSER角色,tadãuser_x可以再次看到关系和数据.
但是user_x不需要具有SUPERUSER权限来访问此数据库.
这个进口转储有什么问题?现在有人怎么解决这个问题?
A.H*_*.H. 62
也许架构的架构权限public受到了破坏.这\dn+两个网站的输出是什么?
输出应如下所示:
List of schemas
Name | Owner | Access privileges | Description
--------+----------+----------------------+------------------------
public | postgres | postgres=UC/postgres | standard public schema
: =UC/postgres
(1 row)
Run Code Online (Sandbox Code Playgroud)
如果=UC/postgres缺少该部件,您可以使用该部件进行恢复
grant all on schema public to public;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
41772 次 |
| 最近记录: |