主页 > 知识库 > 解决linux下set_loginuid failed opening loginuid报错问题

解决linux下set_loginuid failed opening loginuid报错问题

热门标签:电销语音机器人哪个好 百度地图标注未成功 中山防封卡电销卡办理 文山外呼营销系统 拉萨销售外呼系统软件 江苏小型外呼系统软件 常熟外呼系统 电话机器人服务器部署 地图上标注点位的图标

 自从使用php-syslog-ng监控日志信息后,经常发现一些过去会忽略的报错信息,目前正逐一解决中。其中一个报错发生在,我使用密钥通过ssh登陆到服务器的时候,日志信息显示:

Nov 19 10:32:20 printserver auth 10:32:20 pam_loginuid[9691]: set_loginuid failed opening loginuid
Nov 19 10:32:20 printserver auth 10:32:20 remote(pam_unix)[9691]: session opened for user root by (uid=0)
Nov 19 10:32:20 printserver auth 10:32:20 sshd[9689]: Accepted publickey for root from 192.168.228.244 port
1487 ssh2

一、原因
操作系统:红旗DC Server 5.0
分析以前的系统日志,并没有发现类似的报错信息,故怀疑是最近的操作导致的。
从两方面分析:

1、openssh-server从4.0p1升级到4.7p1;
2、使用密钥登陆代替原来的密码登陆方式。

先尝试用原来的密码方式登陆,没有报错;再对比其他机器上原4.0p1版的状态,使用密钥登陆,也没有报错。由于我升级openssh-server的时候,使用它自带的默认配置文件而非系统4.0p1版的配置,故觉得报错,和配置及使用密钥登陆都有关。

二、解决
经查找资料后测试,可通过修改openssh-server的配置文件解决问题。
修改/etc/ssh/sshd_config为:


#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no  #关闭挑战应答方式
UsePAM no  #不使用PAM认证

保存后,重启sshd服务即可。

三、说明
上述两个参数的说明,可从帮助文档得到注解:


# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.

简单来讲,就是如果打开UsePAM,则会根据ChallengeResponseAuthentication来决定是否使用挑战应答方式(我不知道是否这样翻译)。而该方式是根据密码判断的,不能和密钥登陆兼容,所以会出现报错。
不同的配置,可从日志中得到完全不同的结果:
1、关闭ChallengeResponseAuthentication和打开UsePAM
使用密钥登陆:

引用
Nov 19 10:57:20 printserver auth 10:57:20 sshd(pam_unix)[10322]: session opened for user root by root(uid=0)
Nov 19 10:57:20 printserver auth 10:57:20 sshd[10320]: Accepted publickey for root from 192.168.228.244 port 1595 ssh2

2、打开ChallengeResponseAuthentication和UsePAM
使用密钥登陆就会报错,而使用密码登陆是正常的:

Nov 19 12:23:33 printserver sshd(pam_unix)[24454]: session opened for user root by root(uid=0)

四、其他
在Google的时候,发现有另外一种解决方法:点击
就是修改/etc/pam.d/sshd,把下面这行注释:

session required pam_loginuid.so

不过,我在系统中并没有找到这行。反而,从日志可以看到,报错是由PAM调用remote发出的,所以,我修改/etc/pam.d/remote,把这行注释:

引用
session    required     pam_loginuid.so

这样,确认不会再报上面的错误。但登陆的时候,日志就会显示:

Nov 19 10:06:31 printserver sshd[9582]: Accepted publickey for root from 192.168.228.244
port 1228 ssh2
Nov 19 10:06:31 printserver remote(pam_unix)[9584]: session opened for user root by (uid=0)
Nov 19 10:06:31 login -- root[9584]: ROOT LOGIN ON pts/2 FROM 192.168.228.244

发出信息的主机从printserver改为login了,日志分类会有有错,不利于使用咯。
◎至于因为核心没有打开CONFIG_AUDIT功能引起的解决办法
经确认,红旗DC Server 5.0的核心是已经打开CONFIG_AUDIT的,所以,解决方法无效。

标签:湖南 石家庄 淮安 和田 和田 马鞍山 开封 法律问答

巨人网络通讯声明:本文标题《解决linux下set_loginuid failed opening loginuid报错问题》,本文关键词  解决,linux,下,set,loginuid,;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 下面列出与本文章《解决linux下set_loginuid failed opening loginuid报错问题》相关的同类信息!
  • 本页收集关于解决linux下set_loginuid failed opening loginuid报错问题的相关信息资讯供网民参考!
  • 推荐文章