charleschchen
作者charleschchen·2022-01-26 12:48
系统架构师·浪潮商用机器有限公司

设置pam_auth后系统不能ssh登录问题分析

字数 1224阅读 2050评论 0赞 0

问题现象

客户反馈,按Oracle RAC安装文档,将 std_auth 鉴权方式修改为pam_auth 后,系统无法ssh登录。
修改内容:

ssh登录报错:

Using username "root".  
root@172.16.103.146's password:  
Access denied  
root@172.16.103.146's password:  
  

问题分析

首先排除网络问题,在问题主机上尝试ssh localhost直接登录本机,发现同样存在此问题。使用ssh -vvv localhost进行调试,信息如下:

参考ssh协议可知,正常回复为type 52,而回复type 51代SSH_MSG_USERAUTH_FAILURE,即鉴权失败。
https://www.rfc-editor.org/rfc/rfc4252.html

   These are the general authentication message codes:

      SSH_MSG_USERAUTH_REQUEST            50
      SSH_MSG_USERAUTH_FAILURE            51
      SSH_MSG_USERAUTH_SUCCESS            52
      SSH_MSG_USERAUTH_BANNER             53

因此可以确定是因为修改pam_auth 造成。

解决方案

为避免根据 Oracle 安装指引操作后导致 ssh 无法使用,建议在操作将 std_auth 修改为 pam_auth 时,优先完成以下步骤再执行 Oracle 安装指引操作:

  1. 在 /etc/security/login.cfg 文件中,将 usw 下 auth_type 的默认值 std_auth 改为 pam_auth
#chsec -f /etc/security/login.cfg -s usw -a auth_type=PAM_AUTH
  1. /etc/pam.conf 中添加
sshd auth required pam_aix

sshd account required pam_aix

sshd password required pam_aix

sshd session required pam_aix
  1. 编辑 /etc/ssh/sshd_config 文件,找到 UsePAM 行,并将 UsePAM no 改为 UsePAM yes :
UsePAM yes
  1. 重启 ssh
#stopsrc -s sshd

#startsrc -s sshd

详细信息可参考 IBM 官方材料 Enable ssh on AIX to use PAM :

https://www.ibm.com/support/pages/enable-ssh-aix-use-pam

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

X社区推广