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

来源:互联网 发布:求数据库系统概念中文 编辑:程序博客网 时间:2024/05/29 15:54

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

作者:吴伟龙(PrudentWoo)

 

问题描述:

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

 

问题现象:

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





日志信息:

[root@nec3 ~]# tail -f /var/log/messages Dec 13 09:27:58 nec3 init: tty (/dev/tty1) main process ended, respawningDec 13 09:28:03 nec3 init: tty (/dev/tty1) main process (2782) terminated with status 1Dec 13 09:28:03 nec3 init: tty (/dev/tty1) main process ended, respawningDec 13 09:28:43 nec3 init: tty (/dev/tty1) main process (2787) terminated with status 1Dec 13 09:28:43 nec3 init: tty (/dev/tty1) main process ended, respawningDec 13 09:29:51 nec3 init: tty (/dev/tty1) main process (2793) terminated with status 1Dec 13 09:29:51 nec3 init: tty (/dev/tty1) main process ended, respawning

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

        实际上我们在secure日志中看到的信息是Moduleis 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 unknownDec 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 directoryDec 13 09:28:08 nec3 login: PAM adding faulty module: /lib/security/pam_limits.soDec 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 /liblib/   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.so2、ln pam_limits.so[root@nec3 ~]# ln -s /lib64/security/pam_limits.so /lib/security/pam_limits.so3、修改配置文件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 needto ensure that pam_limits isconfigured 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 localaccess and telnet and disabletelnet for all log in methods. Here are examples of the two session entries inthe /etc/pam.d/system-auth file:








0 0
原创粉丝点击