linux本机root账户无法登录,但是远程ssh可登录
1.故障状态
方法一
a.linux本机root账户无法登录(root和密码无误的情况下也无法登录,但是用远程ssh软件可以登录)
b.查看/var/log/secure登录日志(提示无法找到pam_limits.so,该文件是oracle要求的模块)
Jan 5 15:33:50 server181 login: PAM unable to dlopen(/lib/security/pam_limits.so): /lib/security/pam_limits.so: cannot open shared object file: No such file or directory
Jan 5 15:33:50 server181 login: PAM adding faulty module: /lib/security/pam_limits.so
Jan 5 15:33:59 server181 login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Jan 5 15:33:59 server181 login: Module is unknown
Jan 5 15:34:58 server181 sshd[2096]: Accepted publickey for rfadmin from 10.100.40.124 port 64497 ssh2
Jan 5 15:34:58 server181 sshd[2096]: pam_unix(sshd:session): session opened for user rfadmin by (uid=0)
Jan 5 15:36:11 server181 su: pam_unix(su-l:session): session opened for user root by rfadmin(uid=501)
以下是oracle要求的配置(/etc/pam.d/login)
session required /lib/security/pam_limits.so
session required pam_limits.so
2.查看系统中pam_limits.so文件是否存在
[root@server181 ~]# find / -name pam_limits.so
/lib/security/pam_limits.so
发现pam_limits.so文件没有在oracle指定的目录下
3.给pam_limits.so文件做一个软链接
ln -s /lib64/security/pam_limits.so /lib/security/
方法二
vi /etc/pam.d/login
添加下面语句 session required /lib/security/pam_limits.so
后,本地用户不能登录系统;如下解决:
vi /etc/pam.d/login里面的最后一行: “ sessionrequired /lib/security/pam_limits.so ”
把它改成:sessionrequired /lib64/security/pam_limits.so 保存重启ok啦!