如何配置PostgreSQL以使用Windows身份验证? [英] How can I configure PostgreSQL to use Windows Authentication?

查看:206
本文介绍了如何配置PostgreSQL以使用Windows身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置PostgreSQL,并且仅允许某些Windows用户访问数据库中的数据。使用MS SQL设置Windows身份验证非常容易,但是我不知道如何在PostgreSQL中进行设置。

I am trying to setup PostgreSQL and allow only certain Windows users to access the data from the database. Setting up Windows Authentication is Quite easy with MS SQL, but I can't figure out how to set it up in PostgreSQL.

我已经浏览了 http://www.postgresql.org/docs/current/static/auth-methods .html

并编辑了pg_hba文件。但是这样做之后,PostgreSQL服务将无法启动。

and edited the pg_hba file. But after doing so, the PostgreSQL service fails to start.

推荐答案

是否同时在Windows和客户端上运行了Postgresql服务器?您可以对此进行测试,看看是否可行:

Is the Postgresql server running on Windows as well as the clients then you might test with this to see if this works:

host all all 0.0.0.0/0 sspi

Postnusql开发人员Magnus Hagander,详细说明

Magnus Hagander, a Postgresql developer, elaborates on this:

所有从本地计算机连接的用户,您的域或受信任的域将使用SSPI配置的身份验证自动进行身份验证(您可以使用组策略启用/禁用NTLMv2或LM之类的功能-这是Windows配置,而不是PostgreSQL配置)。您仍然需要在中创建登录角色PostgreSQL,仅此而已,请注意,根本没有验证域,仅验证了用户名,因此您在主域和受信任域中的用户Administrator将被视为如果同一用户尝试连接到PostgreSQL。请注意,该方法与Unix客户端不兼容。

"All users connecting from the local machine, your domain, or a trusted domain will be automatically authenticated using the SSPI configured authentication (you can enable/disable things like NTLMv2 or LM using Group Policy - it's a Windows configuration, not a PostgreSQL one). You still need to create the login role in PostgreSQL, but that's it. Note that the domain is not verified at all, only the username. So the user Administrator in your primary and a trusted domain will be considered the same user if they try to connect to PostgreSQL. Note that this method is not compatible with Unix clients."

如果您混合使用Unix-Windows,则必须使用GSSAPI求助于kerberos,这意味着您必须进行一些配置。有关在Windows环境中部署Pg的文章也许会带您走正确的道路。

If you mix Unix-Windows then you have to resort to kerberos using GSSAPI which means you have to do some configuration. This article on deploying Pg in Windows environments may perhaps lead you in the right path.

这篇关于如何配置PostgreSQL以使用Windows身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆