禁用角色不拥有的数据库上的所有操作(包括使用 psql -l 列出)?
我们运行 PostgreSQL 8.3 作为 ERP 系统的数据库服务器。到目前为止,没有必要在 postgres 中的不同用户(8.3 中的角色)下创建不同的数据库。现在它出现了。
问题 1:不具有超级用户权限的用户只能读取/写入其拥有的数据库(假设用户具有 CREATEDB 权限),这是否正确?
问题 2:如何通过 psql -l
命令为用户禁用所有数据库的列表?即使第一个问题的答案是肯定的,那么该列表仍然可供任意用户使用。
谢谢。
We are running PostgreSQL 8.3 as the DB server for our ERP system. So far there was no necessity to create different databases under different users (roles in terms of 8.3) in postgres. And now it has appeared.
Question 1: Is it correct that a user with no superuser privilege can read/write only to its owned databases (assuming the user has the CREATEDB privilege)?
Question 2: How can I disable for a user the listing of all databases via the psql -l
command? Even if the answer to the first question is yes then this listing is still available to an arbitrary user.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有办法在不破坏东西的情况下关闭 psql -l 。您可以在 pg_hba.conf 中使用相同的用户配置选项,只允许用户连接到他们自己的数据库。
There's no way to turn off psql -l without possibly breaking things. You can use the sameuser configuration option in pg_hba.conf to only let users connect to their own databases.
Q1:不是。这都是由各级权限控制的。要写入表,您需要该表的权限等。数据库级别的唯一权限(所有者默认拥有)是创建模式和临时表的能力。这可能不是你的想法。您可能可以这样设置,但这与默认或正常设置相去甚远。
Q2:您可以撤销
pg_database
上的SELECT
权限。但这样做并没有得到真正的支持。我建议你重新考虑一下你是否真的需要它。Q1: No. This is all controlled by privileges at various levels. To write into a table, you need privileges on that table, etc. The only privileges on the database level (which the owner would have by default) are the ability to create schemas and temporary tables. That's probably not what you had in mind. You could probably set it up that way, but it's far from the default or the normal setup.
Q2: You could revoke the
SELECT
privilege onpg_database
. But doing that it not really supported. I suggest you reconsider whether you really need that.回复 1) 是的,这是正确的
回复 2) 我认为可以通过使用
revoke select on pg_database from public
来完成,但我不确定这会产生什么副作用。编辑
您可能会对这个讨论感兴趣:
http://www.mail-archive.com/[电子邮件受保护]/msg64005.html
re 1) yes, that's correct
re 2) I think it can be done by using
revoke select on pg_database from public
but I'm not sure what side-effects that will have.Edit
This discussion might be interesting for you:
http://www.mail-archive.com/[email protected]/msg64005.html
http://wiki.postgresql.org/wiki/Shared_Database_Hosting
Postgres 8.4
主要案例
http://wiki.postgresql.org/wiki/Shared_Database_Hosting
Postgres 8.4
Main case