- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在基于 Windows 的本地网络上工作,我想使用网络的帐户系统来允许用户连接到我的数据库。
据我所知,正确的方法是在“ident”上设置 pg_hba 方法:
host all all 10.0.0.0/8 ident
但是当我这样做时,我收到一条消息说
"Error connecting to the server: FATAL: ident authentication failed for user <user>"
据我所知,我的猜测是可能存在两个问题:- 我没有正确设置 pg_hba。- 我创建的角色与服务器找到的身份不匹配。
在第一种情况下,你能判断语法是否正确吗?我试图在 ident 之后添加“sameuser”,但它损坏了我的 pg_hba,还有 map=sameuser,但我得到了与提到的相同的错误。
在第二种情况下,我在每个 session 上使用批处理来获取用户名,如
find /c "%username%"
或 Python3.6 函数 os.getlogin(),产生相同的结果。
PostgreSQL 如何获得它的“身份”?更重要的是,我如何重现此过程以了解 PostgreSQL 将识别的 session 标识?
谢谢。
最佳答案
看完ident.conf manual并使用 hba_file manual 中的示例,我这样设置:
postgres=# create user ident_user_db;
CREATE ROLE
vao@vao-X102BA:~$ sudo tail -n 1 /etc/postgresql/9.6/main/pg_hba.conf
host all all 192.168.8.0/24 ident map=vao_ident
vao@vao-X102BA:~$ sudo tail -n 1 /etc/postgresql/9.6/main/pg_ident.conf
vao_ident vao ident_user_db
现在我从同一台机器连接到它的外部 IP:
vao@vao-X102BA:~$ psql -h 192.168.8.107 -U ident_user_db
psql: FATAL: Ident authentication failed for user "ident_user_db"
FATAL: Ident authentication failed for user "ident_user_db"
似曾相识。虽然我遵循手册。最后要检查的事情:
vao@vao-X102BA:~$ telnet localhost 113
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
所以没有什么能提供我的身份。根据建议here
vao@vao-X102BA:~$ sudo apt-get install oidentd
...
vao@vao-X102BA:~$ telnet localhost 113
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
所以现在试试:
vao@vao-X102BA:~$ psql -h 192.168.8.107 -U ident_user_db -d vao
psql (9.6.3)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
希望对你有帮助
关于PostgreSQL 9.5 在 pg_hba 中使用 ident,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45033058/
这是与 postgresql 9.6.9 一起使用的。 这是我的 pg_hba.conf 文件的一部分: local sameuser all
我正在 Ub12.04 服务器上安装和运行 postgres 服务器。 谁能帮我找到打开 pg_hba.conf 以接受来自任何主机的任何连接的语法? 我试过了 host all all 0.0.0.
我正在寻找一种以编程方式编辑 pg_hba.conf 的方法,类似于 pg_conftool 允许您编辑 postgresql.conf 的方式: ~$ pg_conftool 11 main set
在 pg_hba.conf 中,我有 host all all 127.0.0.1/32 md5 host all
好的,首先我是法国人,对于错误消息可能的不理解或错误翻译,我们深表歉意。 我有一个 Raspberry,上面有一个 Tomcat 服务器。另外,我也使用 Postgresql。 在我的网站上,服务器端
我要修改线路 local all all peer 到 local all all md5 在 shell 脚本中。最好的方法是什么?如果我要搜索该行,我应该寻找什么字符串? pg_hba.conf中
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
pg_hba.conf 配置详解 该文件位于初始化安装的数据库目录下 编辑 pg_hba.conf 配置文件 ?
我正在尝试连接到我在远程计算机上设置的 PostgreSQL 数据库。 我收到以下错误: org.postgresql.util.PSQLException: FATAL: no pg_hba.con
所以我正在尝试设置 PostgreSQL 以在我的 Mac 10.9 Mavericks 机器上与 metasploit 一起使用。我正在尝试按照此页面上列出的说明进行操作。 http://www.d
我见过的所有示例都有单独一行的注释。 下面的尾随评论可以吗? host all all 0.0.0.0/0 md5 # accept all connections 最佳答
我有 postgres 在树莓派上运行,我正在变老 psycopg2.OperationalError: FATAL: Peer authentication failed for user "ge
我正在尝试远程访问安装在 IP A.A.A.A 的服务器上的 postgresql。有两台服务器,其中一台的IP为A.A.A.A,安装了postgresql;另一个有IP B.B.B.B. 我编辑了
在我们运行时安装 postgres 之后,正在为我的一个客户端设置服务器我们遇到以下错误的服务器。当我凝视它时,有一些可用的解决方案,但没有一个对我有用,你能看看它并说出发生了什么吗。 Status:
当我尝试使用 DBI 连接时出现以下错误 DBI connect('database=chaosLRdb;host=192.168.0.1;port=5433','postgres',...) fai
所以,我正在尝试为我的应用程序(针对 Ubuntu 16)创建一个安装脚本。它必须创建一个 postgresql 用户,授予该用户通过密码进行身份验证的权限,并授予该用户在本地进行身份验证的权限。我只
我发现设置 pg_hba.conf 文件非常困难。这是浪费我时间的常见情况。我需要做什么? 首先,在 Amazon、Digital Ocean 或我自己的硬件上安装新安装的 Linux 发行版的虚拟机
我弄乱了我的 pg_hba.conf 文件,我不想重新安装 - 我在网络上的任何地方都找不到默认的文件。有人有吗? 最佳答案 以下内容默认pg_hba.conf在 PostgreSQL 12 中 #
我正在使用 circleci 运行一些涉及数据库的测试。我的服务器使用 node 和 sequelize 作为 orm。每当我运行测试时,都会出现以下错误: SequelizeConnectionEr
我正在尝试为 Hive 设置 PostgreSQL。这是 /var/lib/pgsql/data/pg_hba.conf 的内容: # TYPE DATABASE USER
我是一名优秀的程序员,十分优秀!