免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: very263
打印 上一主题 下一主题

【问题解决】终端不能登陆,只能用SSH,为什么? [复制链接]

论坛徽章:
0
11 [报告]
发表于 2009-05-14 13:55 |只看该作者
/etc/pam.d
  1. #%PAM-1.0
  2. auth                sufficient        pam_rootok.so
  3. # Uncomment the following line to implicitly trust users in the "wheel" group.
  4. #auth                sufficient        pam_wheel.so trust use_uid
  5. # Uncomment the following line to require a user to be in the "wheel" group.
  6. auth                required        pam_wheel.so use_uid
  7. auth                include                system-auth
  8. account                sufficient        pam_succeed_if.so uid = 0 use_uid quiet
  9. account                include                system-auth
  10. password        include                system-auth
  11. session                include                system-auth
  12. session                optional        pam_xauth.so
  13. auth            sufficient      pam_rootok.so debug
  14. auth            required        pam_wheel.so group=wheel
复制代码
/etc/pam.d
  1. #%PAM-1.0
  2. auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
  3. auth       include      system-auth
  4. account    required     pam_nologin.so
  5. account    include      system-auth
  6. password   include      system-auth
  7. # pam_selinux.so close should be the first session rule
  8. session    required     pam_selinux.so close
  9. session    include      system-auth
  10. session    required     pam_loginuid.so
  11. session    optional     pam_console.so
  12. # pam_selinux.so open should only be followed by sessions to be executed in the user context
  13. session    required     pam_selinux.so open
  14. session    optional     pam_keyinit.so force revoke
  15. session required /lib/security/pam_limits.so
复制代码
/etc/passwd
  1. root:x:0:0:root:/root:/bin/bash
  2. bin:x:1:1:bin:/bin:/sbin/nologin
  3. daemon:x:2:2:daemon:/sbin:/sbin/nologin
  4. #adm:x:3:4:adm:/var/adm:/sbin/nologin
  5. #lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
  6. #sync:x:5:0:sync:/sbin:/bin/sync
  7. #shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
  8. #halt:x:7:0:halt:/sbin:/sbin/halt
  9. #mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
  10. #news:x:9:13:news:/etc/news:
  11. #uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
  12. #operator:x:11:0:operator:/root:/sbin/nologin
  13. #games:x:12:100:games:/usr/games:/sbin/nologin
  14. #gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
  15. ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
  16. nobody:x:99:99:Nobody:/:/sbin/nologin
  17. vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
  18. sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
  19. dbus:x:81:81:System message bus:/:/sbin/nologin
  20. haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
  21. Fing:x:500:500::/home/Fing:/bin/bash
  22. apache:x:48:48:Apache:/var/www:/sbin/nologin
  23. mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
  24. webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
复制代码
/etc/ssh/sshd_config
  1. #        $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

  2. # This is the sshd server system-wide configuration file.  See
  3. # sshd_config(5) for more information.

  4. # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

  5. # The strategy used for options in the default sshd_config shipped with
  6. # OpenSSH is to specify options with their default value where
  7. # possible, but leave them commented.  Uncommented options change a
  8. # default value.

  9. Port 19266
  10. #Protocol 2,1
  11. Protocol 2
  12. #AddressFamily any
  13. ListenAddress 192.168.1.2
  14. #ListenAddress ::

  15. # HostKey for protocol version 1
  16. #HostKey /etc/ssh/ssh_host_key
  17. # HostKeys for protocol version 2
  18. #HostKey /etc/ssh/ssh_host_rsa_key
  19. #HostKey /etc/ssh/ssh_host_dsa_key

  20. # Lifetime and size of ephemeral version 1 server key
  21. #KeyRegenerationInterval 1h
  22. ServerKeyBits 1024

  23. # Logging
  24. # obsoletes QuietMode and FascistLogging
  25. #SyslogFacility AUTH
  26. SyslogFacility AUTHPRIV
  27. #LogLevel INFO

  28. # Authentication:

  29. #LoginGraceTime 2m
  30. PermitRootLogin no
  31. #StrictModes yes
  32. #MaxAuthTries 6

  33. #RSAAuthentication yes
  34. #PubkeyAuthentication yes
  35. #AuthorizedKeysFile        .ssh/authorized_keys

  36. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
  37. #RhostsRSAAuthentication no
  38. # similar for protocol version 2
  39. #HostbasedAuthentication no
  40. # Change to yes if you don't trust ~/.ssh/known_hosts for
  41. # RhostsRSAAuthentication and HostbasedAuthentication
  42. #IgnoreUserKnownHosts no
  43. # Don't read the user's ~/.rhosts and ~/.shosts files
  44. #IgnoreRhosts yes

  45. # To disable tunneled clear text passwords, change to no here!
  46. #PasswordAuthentication yes
  47. #PermitEmptyPasswords no
  48. PasswordAuthentication yes

  49. # Change to no to disable s/key passwords
  50. #ChallengeResponseAuthentication yes
  51. ChallengeResponseAuthentication no

  52. # Kerberos options
  53. #KerberosAuthentication no
  54. #KerberosOrLocalPasswd yes
  55. #KerberosTicketCleanup yes
  56. #KerberosGetAFSToken no

  57. # GSSAPI options
  58. #GSSAPIAuthentication no
  59. GSSAPIAuthentication yes
  60. #GSSAPICleanupCredentials yes
  61. GSSAPICleanupCredentials yes

  62. # Set this to 'yes' to enable PAM authentication, account processing,
  63. # and session processing. If this is enabled, PAM authentication will
  64. # be allowed through the ChallengeResponseAuthentication mechanism.
  65. # Depending on your PAM configuration, this may bypass the setting of
  66. # PasswordAuthentication, PermitEmptyPasswords, and
  67. # "PermitRootLogin without-password". If you just want the PAM account and
  68. # session checks to run without PAM authentication, then enable this but set
  69. # ChallengeResponseAuthentication=no
  70. #UsePAM no
  71. UsePAM no

  72. # Accept locale-related environment variables
  73. AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
  74. AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
  75. AcceptEnv LC_IDENTIFICATION LC_ALL
  76. #AllowTcpForwarding yes
  77. #GatewayPorts no
  78. #X11Forwarding no
  79. X11Forwarding yes
  80. #X11DisplayOffset 10
  81. #X11UseLocalhost yes
  82. #PrintMotd yes
  83. #PrintLastLog yes
  84. #TCPKeepAlive yes
  85. #UseLogin no
  86. #UsePrivilegeSeparation yes
  87. #PermitUserEnvironment no
  88. #Compression delayed
  89. #ClientAliveInterval 0
  90. #ClientAliveCountMax 3
  91. #ShowPatchLevel no
  92. #UseDNS yes
  93. #PidFile /var/run/sshd.pid
  94. #MaxStartups 10
  95. #PermitTunnel no

  96. # no default banner path
  97. #Banner /some/path

  98. # override default of no subsystems
  99. Subsystem        sftp        /usr/libexec/openssh/sftp-server
复制代码
/etc/securetty
  1. console
  2. vc/1
  3. vc/2
  4. vc/3
  5. vc/4
  6. vc/5
  7. vc/6
  8. vc/7
  9. vc/8
  10. vc/9
  11. vc/10
  12. vc/11
  13. tty1
  14. #tty2
  15. #tty3
  16. #tty4
  17. #tty5
  18. #tty6
  19. #tty7
  20. #tty8
  21. #tty9
  22. #tty10
  23. #tty11
复制代码
曾执行了
  1. # chattr +i /etc/passwd
  2. # chattr +i /etc/shadow
  3. # chattr +i /etc/group
  4. # chattr +i /etc/gshadow
复制代码
  1. # rm -f /etc/issue
  2. # rm -f /etc/issue.net
  3. # touch /etc/issue
  4. # touch /etc/issue.net
复制代码
  1. # chmod -R 700 /etc/rc.d/init.d/*
复制代码


红色是我修改过的,但是我恢复了还是不行的。
命令也是恢复过的,这种情况我之前也出现过,但是我重安装了系统,我还是照样设置,但是也是出现,问题现在是,我根本不知道产生这结果是那一步产生的,麻烦了。。。

[ 本帖最后由 very263 于 2009-5-14 14:00 编辑 ]

论坛徽章:
0
12 [报告]
发表于 2009-05-14 14:05 |只看该作者
我是在红旗4.0桌面版后,不记得那时候的redhat是几版了,就没有接触过linux的系统了,安装centos 5.3也是上个月中开始的,到现在,我安装的系统不下30次。已经烦了,今次难道又要再次安装,但是安装后由于不是很清楚,也是按照一些网上教程来做的,出现这种情况根本就不知道是哪一步。所以恳请及麻烦各位好好给我看看了,小弟先谢了。

论坛徽章:
0
13 [报告]
发表于 2009-05-14 14:13 |只看该作者
/var/log/secure


May 14 14:09:44 localhost login: Module is unknown
May 14 14:09:47 localhost login: PAM unable to dlopen(/lib/security/pam_limits.so)
May 14 14:09:47 localhost login: PAM [error: /lib/security/pam_limits.so: wrong ELF class: ELFCLASS32]
May 14 14:09:47 localhost login: PAM adding faulty module: /lib/security/pam_limits.so
May 14 14:09:55 localhost login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
May 14 14:09:55 localhost login: Module is unknown
May 14 14:09:57 localhost login: PAM unable to dlopen(/lib/security/pam_limits.so)
May 14 14:09:57 localhost login: PAM [error: /lib/security/pam_limits.so: wrong ELF class: ELFCLASS32]
May 14 14:09:57 localhost login: PAM adding faulty module: /lib/security/pam_limits.so
May 14 14:10:02 localhost login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
May 14 14:10:03 localhost login: Module is unknown
May 14 14:10:06 localhost login: PAM unable to dlopen(/lib/security/pam_limits.so)
May 14 14:10:06 localhost login: PAM [error: /lib/security/pam_limits.so: wrong ELF class: ELFCLASS32]
May 14 14:10:06 localhost login: PAM adding faulty module: /lib/security/pam_limits.so
May 14 14:10:12 localhost login: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost=  user=Fing
May 14 14:10:14 localhost login: FAILED LOGIN 1 FROM (null) FOR Fing, Authentication failure
May 14 14:10:22 localhost login: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost=  user=root
May 14 14:10:24 localhost login: FAILED LOGIN 2 FROM (null) FOR root, Authentication failure
May 14 14:10:33 localhost login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
May 14 14:10:33 localhost login: Module is unknown

发现了这些,想必就是问题所在了,但是问题怎么解决呢?

论坛徽章:
0
14 [报告]
发表于 2009-05-14 14:22 |只看该作者
哈哈,找到了,原来是
在/etc/pam.d/login
里面
session required /lib/security/pam_limits.so

由于我是安装的64位系统,而加载的是32位的pam_limits.so,所以问题就出现了,

一下修改在/etc/pam.d/login

session required /lib64/security/pam_limits.so

问题解决

谢谢大家,没有大家的热心我也想不起看/var/log/secure,谢了!

论坛徽章:
0
15 [报告]
发表于 2010-04-01 18:26 |只看该作者
我也遇到这个问题了, 郁闷了好几天,今天腾出时间在网上搜了半天,都没有解决,还是cu上看到你的帖子,太感谢你了!!!

论坛徽章:
8
2015年辞旧岁徽章
日期:2015-03-03 16:54:15午马
日期:2015-02-04 12:00:07羊年新春福章
日期:2015-02-04 11:57:56双子座
日期:2014-12-02 11:44:59金牛座
日期:2014-10-08 16:47:08狮子座
日期:2014-08-29 13:37:46巳蛇
日期:2014-08-26 17:32:29NBA常规赛纪念章
日期:2015-05-04 22:32:03
16 [报告]
发表于 2010-04-01 19:05 |只看该作者
回复 14# very263


学习了 呵呵

论坛徽章:
0
17 [报告]
发表于 2010-04-02 09:57 |只看该作者
回复 14# very263


    呵呵,不错

论坛徽章:
0
18 [报告]
发表于 2010-07-02 17:36 |只看该作者
哈哈,找到了,原来是
在/etc/pam.d/login
里面
session required /lib/security/pam_limits.so

由于 ...
very263 发表于 2009-05-14 14:22



    谢谢了!!
原来64位不同了呀。。。

论坛徽章:
0
19 [报告]
发表于 2015-12-09 09:50 |只看该作者
一个六年前的帖子解决了困扰我好久的问题 。。。。。 谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP