您好,我有一台运行 18.04 的服务器,我通过终端进入,但有时它会冻结,我无法访问它 - 有什么建议吗?
Jan 27 14:55:48 rene-desktop sshd[13387]: pam_unix(sshd:session): session opened for user rene by (uid=0)
Jan 27 14:56:13 rene-desktop sshd[13387]: pam_unix(sshd:session): session closed for user rene
Jan 27 14:56:13 rene-desktop sshd[927]: Received signal 15; terminating.
Jan 27 14:56:13 rene-desktop systemd[1282]: Closed GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 14:56:13 rene-desktop systemd[1590]: Closed GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 14:56:15 rene-desktop systemd[1]: Unmounting /media/odroidxu4-nasshare...
Jan 27 14:56:15 rene-desktop systemd[1]: Unmounted /media/odroidxu4-nasshare.
Jan 27 14:56:15 rene-desktop systemd[1]: Unset automount media-odroidxu4\x2dnasshare.automount.
Jan 27 14:57:14 rene-desktop sshd[926]: Server listening on 0.0.0.0 port 22.
Jan 27 14:57:14 rene-desktop sshd[926]: Server listening on :: port 22.
Jan 27 14:57:17 rene-desktop sshd[926]: Received SIGHUP; restarting.
Jan 27 14:57:17 rene-desktop sshd[926]: Server listening on 0.0.0.0 port 22.
Jan 27 14:57:17 rene-desktop sshd[926]: Server listening on :: port 22.
Jan 27 14:57:18 rene-desktop sshd[926]: Received SIGHUP; restarting.
Jan 27 14:57:18 rene-desktop sshd[926]: Server listening on 0.0.0.0 port 22.
Jan 27 14:57:18 rene-desktop sshd[926]: Server listening on :: port 22.
Jan 27 14:57:18 rene-desktop systemd[1260]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:02:05 rene-desktop sshd[1568]: Accepted password for rene from 192.168.1.162 port 53400 ssh2
Jan 27 15:02:05 rene-desktop sshd[1568]: pam_unix(sshd:session): session opened for user rene by (uid=0)
Jan 27 15:02:06 rene-desktop systemd[1570]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:13:50 rene-desktop sshd[1568]: pam_unix(sshd:session): session closed for user rene
Jan 27 15:13:50 rene-desktop systemd[1570]: Closed GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:36:02 rene-desktop sshd[1815]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.162 user=rene
Jan 27 15:36:04 rene-desktop sshd[1815]: Failed password for rene from 192.168.1.162 port 53524 ssh2
Jan 27 15:36:09 rene-desktop sshd[1815]: Failed password for rene from 192.168.1.162 port 53524 ssh2
Jan 27 15:36:14 rene-desktop sshd[1815]: Accepted password for rene from 192.168.1.162 port 53524 ssh2
Jan 27 15:36:14 rene-desktop sshd[1815]: pam_unix(sshd:session): session opened for user rene by (uid=0)
Jan 27 15:36:14 rene-desktop systemd[1817]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:37:20 rene-desktop gnome-keyring-ssh.desktop[2026]: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
Jan 27 15:37:20 rene-desktop gnome-keyring-secrets.desktop[2028]: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
Jan 27 15:37:20 rene-desktop gnome-keyring-pkcs11.desktop[2025]: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
Jan 27 15:37:21 rene-desktop systemd[1]: media-odroidxu4\x2dnasshare.automount: Got automount request for /media/odroidxu4-nasshare, triggered by 2117 (pool)
Jan 27 15:37:21 rene-desktop systemd[1]: Mounting /media/odroidxu4-nasshare...
Jan 27 15:37:22 rene-desktop systemd[1]: Mounted /media/odroidxu4-nasshare.
Jan 27 15:38:20 rene-desktop sudo[2813]: rene : TTY=pts/1 ; PWD=/home/rene ; USER=root ; COMMAND=/etc/init.d/ssh restart
Jan 27 15:38:20 rene-desktop sshd[926]: Received signal 15; terminating.
Jan 27 15:38:20 rene-desktop sshd[2828]: Server listening on 0.0.0.0 port 22.
Jan 27 15:38:20 rene-desktop sshd[2828]: Server listening on :: port 22.
Jan 27 15:40:17 rene-desktop sshd[2828]: Received signal 15; terminating.
Jan 27 15:40:17 rene-desktop sshd[1815]: pam_unix(sshd:session): session closed for user rene
Jan 27 15:40:17 rene-desktop systemd[1260]: Closed GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:40:17 rene-desktop systemd[1817]: Closed GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:40:18 rene-desktop systemd[1]: Unmounting /media/odroidxu4-nasshare...
Jan 27 15:40:18 rene-desktop systemd[1]: Unmounted /media/odroidxu4-nasshare.
Jan 27 15:40:18 rene-desktop systemd[1]: Unset automount media-odroidxu4\x2dnasshare.automount.
Jan 27 15:41:18 rene-desktop sshd[920]: Server listening on 0.0.0.0 port 22.
Jan 27 15:41:18 rene-desktop sshd[920]: Server listening on :: port 22.
Jan 27 15:41:21 rene-desktop sshd[920]: Received SIGHUP; restarting.
Jan 27 15:41:21 rene-desktop sshd[920]: Server listening on 0.0.0.0 port 22.
Jan 27 15:41:21 rene-desktop sshd[920]: Server listening on :: port 22.
Jan 27 15:41:21 rene-desktop sshd[920]: Received SIGHUP; restarting.
Jan 27 15:41:21 rene-desktop sshd[920]: Server listening on 0.0.0.0 port 22.
Jan 27 15:41:21 rene-desktop sshd[920]: Server listening on :: port 22.
Jan 27 15:41:22 rene-desktop systemd[1275]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:41:29 rene-desktop systemd[1565]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Jan 27 15:41:30 rene-desktop gnome-keyring-ssh.desktop[1683]: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
Jan 27 15:41:30 rene-desktop gnome-keyring-secrets.desktop[1684]: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
Jan 27 15:41:31 rene-desktop systemd[1]: media-odroidxu4\x2dnasshare.automount: Got automount request for /media/odroidxu4-nasshare, triggered by 1771 (pool)
Jan 27 15:41:31 rene-desktop systemd[1]: Mounting /media/odroidxu4-nasshare...
Jan 27 15:41:32 rene-desktop systemd[1]: Mounted /media/odroidxu4-nasshare.
Jan 27 15:46:26 rene-desktop sshd[2183]: Accepted password for rene from 192.168.1.162 port 49755 ssh2
Jan 27 15:46:26 rene-desktop sshd[2183]: pam_unix(sshd:session): session opened for user rene by (uid=0)
Jan 27 15:51:40 rene-desktop sshd[2436]: Accepted password for rene from 192.168.1.162 port 49787 ssh2
Jan 27 15:51:40 rene-desktop sshd[2436]: pam_unix(sshd:session): session opened for user rene by (uid=0)
Jan 27 15:52:40 rene-desktop sshd[2183]: pam_unix(sshd:session): session closed for user rene
Jan 27 15:52:44 rene-desktop sshd[2436]: pam_unix(sshd:session): session closed for user rene
Jan 27 15:57:58 rene-desktop sshd[2602]: Accepted password for rene from 192.168.1.162 port 49817 ssh2
Jan 27 15:57:58 rene-desktop sshd[2602]: pam_unix(sshd:session): session opened for user rene by (uid=0)
提前致谢 :)
答案1
就我而言,以下解决方案有帮助:~/.ssh/config
在您的 ssh 客户端计算机中创建文件:
$ nano ~/.ssh/config
# Source:
# http://linuxbsdos.com/2016/11/05/solution-to-freezing-ssh-sessions-on-ubuntu-16-10/
# Sets number of server alive messages which may be sent without ssh receiving any messages back from the server.
ServerAliveCountMax 3
# Timeout interval (in seconds) after which if no data has been received from the server, ssh will send a message
# through the encrypted channel to request a response from the server.
ServerAliveInterval 5