如何解决linux下set_loginuidfailedopeningloginuid报错问题

本篇内容介绍了“如何解决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 ssh3

一、原因
操作系统:红旗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 ssh3

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 ssh3
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_loginuidfailedopeningloginuid报错问题
本文来源:http://bzwzjz.com/article/pciods.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 古蔺网站建设 成都网站制作 外贸网站设计方案 手机网站制作 企业网站建设 成都网站制作 成都商城网站建设 重庆网站建设 网站制作公司 成都网站建设 成都网站建设公司 企业网站制作 成都网站建设公司 响应式网站建设 成都网站制作公司 成都定制网站建设 高端网站设计 成都网站建设流程 H5网站制作 成都响应式网站建设公司 四川成都网站设计 成都网站设计公司