你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux 无法从本地字符界面(tty1-tty6)登陆深度解析

[日期:2016-12-18] 来源:Linux社区  作者:吴伟龙(PrudentWoo) [字体:大 中 小]

问题描述:

每次装完Oracle数据库之后,本地的tty1-tty6就无法登陆,只能通过tty或tty7图形终端登陆。

问题现象:

输入完用户名密码之后,自动弹回如下界面:


 
     
日志信息:

[root@nec3 ~]# tail -f /var/log/messages

Dec 13 09:27:58 nec3 init: tty (/dev/tty1) main process ended, respawning
Dec 13 09:28:03 nec3 init: tty (/dev/tty1) main process (2782) terminated with status 1
Dec 13 09:28:03 nec3 init: tty (/dev/tty1) main process ended, respawning
Dec 13 09:28:43 nec3 init: tty (/dev/tty1) main process (2787) terminated with status 1
Dec 13 09:28:43 nec3 init: tty (/dev/tty1) main process ended, respawning
Dec 13 09:29:51 nec3 init: tty (/dev/tty1) main process (2793) terminated with status 1
Dec 13 09:29:51 nec3 init: tty (/dev/tty1) main process ended, respawning

      我们可以从上面的message日志中看到本地tty1登陆的这个动作,但是没有报错,那么登陆无非要去进行用户名和密码验证,那么用户密码验证信息会记录在名为secure的日志中,如果报密码错误日志中会显示验证失败,日志条目为:FAILED LOGIN 1 FROM (null) FOR root, Authentication failure。

      实际上我们在secure日志中看到的信息是Module is unknow以及无法打开pam_limits.so模块。

[root@nec3 ~]# tail -f /var/log/secure

Dec 13 09:28:03 nec3 login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Dec 13 09:28:03 nec3 login: Module is unknown
Dec 13 09:28:08 nec3 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
Dec 13 09:28:08 nec3 login: PAM adding faulty module: /lib/security/pam_limits.so
Dec 13 09:28:43 nec3 login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Dec 13 09:28:43 nec3 login: Module is unknown

日志分析:

      根据上面的日志条目中我们可以看到有无效模块,而这个无效的模块信息是我们在数据库安装过程中添加到/etc/pam.d/login配置文件中的,我现在需要判断下这个模块是否存在,为什么需要这个模块。

[root@nec3 ~]# grep pam_limits /etc/pam.d/login

session    required    /lib/security/pam_limits.so

[root@nec3 ~]# ls -rtl /lib
lib/  lib64/
[root@nec3 ~]# ls -rtl /lib/security/pam*
ls: cannot access /lib/security/pam*: No such file or directory

      那么我们可以看到该模块是不存在的,随即我们再看下lib64这个目录中是否有oracle安装所需的该模块。

[root@nec3 ~]# ls -rtl /lib64/security/pam_limits.so

-rwxr-xr-x. 1 root root 18592 Oct  7  2013 /lib64/security/pam_limits.so
      那么我们可以清楚的看到在这里是存在这个模块的。

问题处理:

      既然已经看到问题的原因,那么将会有如下三个解决方案:

1、    拷贝条目:

[root@nec3 ~]# cp /lib64/security/pam_limits.so /lib/security/pam_limits.so
[root@nec3 ~]# ls -rtl /lib/security/pam_limits.so
-rwxr-xr-x. 1 root root 18592 Oct  7  2013 /lib/security/pam_limits.so

2、    ln pam_limits.so
[root@nec3 ~]# ln -s /lib64/security/pam_limits.so /lib/security/pam_limits.so
   
3、    修改配置文件login为如下:
[root@nec3 ~]# grep pam_limits /etc/pam.d/login
session    required    /lib64/security/pam_limits.so
 

后记:

      文中提到为什么要用pam_limits.so这个模块,因为我们在配置Oracle部署环境的时候配置了limits.conf限制文件,那么我们要使这个配置生效,必须要确保pam_limits.so被加入到登陆配置文件中应用生效。

参考:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Tuning_and_Optimizing_Red_Hat_Enterprise_Linux_for_Oracle_9i_and_10g_Databases/chap-Oracle_9i_and_10g_Tuning_Guide-Setting_Shell_Limits_for_the_Oracle_User.html

That these limits work you also need to ensure that pam_limits is configured in the /etc/pam.d/system-auth file, or in /etc/pam.d/sshd for ssh, /etc/pam.d/su for su, or /etc/pam.d/login for local access and telnet and disable telnet for all log in methods. Here are examples of the two session entries in the /etc/pam.d/system-auth file:

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-12/138497.htm

linux
相关资讯       tty1  tty6 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款