登录成功后Linux关闭连接

rym*_*ymo 24 linux ssh login

我正在使用 Debian 5.2.2 的服务器上工作。对 Linux 几乎没有任何管理知识,我想我搞砸了。我使用 apt-get update 和 apt-get upgrade 来更新所有内容,然后我下载并安装了 Apache、PHP 和 MySQL。这些工具似乎工作正常,但现在我什至无法通过本地控制台登录到服务器。如果我尝试通过 GUI 登录,或者如果我尝试通过 ssh、scp 或其他任何方式远程登录,我会在成功登录后立即断开连接。换句话说,初始连接没有问题,但是当我输入正确的用户名和密码(对于 root 或任何用户)时,我断开连接。使用 GUI,屏幕会变黑一秒钟,然后让我回到登录提示。使用 ssh,我得到“与 [服务器] 的连接已关闭”。

任何帮助表示赞赏,如果有任何方法可以提供更多信息,请告诉我。感谢您的时间。

编辑:

-- 任何用户都可以登录本地控制台

-- 目前我没有对机器的本地访问权限,所以我现在能做的就是 ssh。这是我输入密码后ssh -vvv [server]的输出:

Linux xxxxxxx.com 2.6.26.8+20091222+1056-debhawk-5.2.2-custom #1 SMP PREEMPT Tue Dec 22 10:58:57 EST 2009 i686

Last login: Mon Apr 30 14:48:07 2012 from xxxxxxx.com
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 fd -1/-1)

debug3: channel 0: close_fds r -1 w -1 e 6
Connection to xxx.x.xx.xx closed.
debug1: Transferred: stdin 0, stdout 0, stderr 35 bytes in 0.0 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 3845.3
debug1: Exit status 254
Run Code Online (Sandbox Code Playgroud)

Tom*_*Tom 28

有几个类似的帖子表明,由于 shell 路径设置不正确,这可能是生成 shell 的问题 /etc/passwd

要检查这一点,请确定您的用户 shell 路径是否存在并且是可执行的;

# cat /etc/passwd | grep tomh
tomh:x:1000:1000:Tom H:/home/tomh:/bin/bash <-- check this exists
Run Code Online (Sandbox Code Playgroud)

检查外壳是否存在:

# file /bin/bash
/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, stripped
Run Code Online (Sandbox Code Playgroud)

此外,请检查 shell 是否未设置为/sbin/nologinor 或/bin/false,即使身份验证成功,这也会阻止登录。

http://www.linuxforums.org/forum/ubuntu-linux/173779-solved-ssh-issue.html
http://www.unix.com/hp-ux/169496-solved-ssh-debug1-exit-status -254-problem.html
http://www.mail-archive.com/seawolf-list@redhat.com/msg04460.html


小智 5

我的问题是登录用户名目录在目录中不可用/home。因此,如果您有一个名为“testuser”的用户,请确保该/home/testuser目录可用。从/var/log/messages文件中得知。


ase*_*seq 2

如果您使用 LDAP,请替换所有出现的内容:

pam_unix_*.so
Run Code Online (Sandbox Code Playgroud)

在 /etc/pam.d/ 的所有文件中:

pam_unix.so
Run Code Online (Sandbox Code Playgroud)

这是 libpam-ldap 包中的错误(示例 pam.d 文件),请参阅:http ://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612825

确保系统可以正确解析,ssh对此有一点讲究。

检查 /etc/secuiry/limits.conf 以查看是否有任何帐户对登录数量有硬性限制并增加这些限制,即:

*       hard    maxlogins   0
Run Code Online (Sandbox Code Playgroud)

除了 Bram 提到的 /var/log/messages 之外,还要检查 /var/log/auth.log 并粘贴任何相关输出。太多的信息总比太少的信息好。