ssh 登录报错 packet_write_wait: Connection to x.x.x.x port 22: Broken pipe

问题现象

用 ssh 命令连接服务器之后,如果一段时间不操作,再次进入 Terminal 时会有一段时间没有响应,然后就出现错误提示:

Write failed: Broken pipe

只能重新用 ssh 命令进行连接。

解决方法

方法一:如果您有多台服务器,不想在每台服务器上设置,只需在客户端的 ~/.ssh/ 文件夹中添加 config 文件,并添加下面的配置:

ServerAliveInterval 60

方法二:如果您有多台个人管理服务器,不想在每个客户端进行设置,只需在服务器的 /etc/ssh/sshd_config 中添加如下的配置:

ClientAliveInterval 60

方法三:如果您只想让当前的 ssh 保持连接,可以使用以下的命令:

$ ssh -o ServerAliveInterval=60 user@sshserver

转载自:http://www.talkwithtrend.com/Question/225451-1370171

阅读更多

ssh登入, 报错packet_write_wait: Connection to *.*.*.*: Broken pipe

12-15

OpenSSH_6.9p1, LibreSSL 2.1.8rndebug1: Reading configuration data /Users/hugh/.ssh/configrndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 21: Applying options for *rndebug1: Connecting to *.*.*.* [*.*.*.*] port 50101.rndebug1: Connection established.rndebug1: identity file /Users/hugh/.ssh/id_rsa type 1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /Users/hugh/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /Users/hugh/.ssh/id_dsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /Users/hugh/.ssh/id_dsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /Users/hugh/.ssh/id_ecdsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /Users/hugh/.ssh/id_ecdsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /Users/hugh/.ssh/id_ed25519 type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /Users/hugh/.ssh/id_ed25519-cert type -1rndebug1: Enabling compatibility mode for protocol 2.0rndebug1: Local version string SSH-2.0-OpenSSH_6.9rndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.3rndebug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000rndebug1: Authenticating to *.*.*.*:50101 as 'hugh.li'rndebug1: SSH2_MSG_KEXINIT sentrndebug1: SSH2_MSG_KEXINIT receivedrndebug1: kex: server->client aes128-ctr umac-64@openssh.com nonerndebug1: kex: client->server aes128-ctr umac-64@openssh.com nonerndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<8192) sentrndebug1: got SSH2_MSG_KEX_DH_GEX_GROUPrndebug1: SSH2_MSG_KEX_DH_GEX_INIT sentrndebug1: got SSH2_MSG_KEX_DH_GEX_REPLYrndebug1: Server host key: ssh-rsa SHA256:Su9fk1v6T02za6PhYZaL4mMvXtWy76CEatYGHwEalaErndebug1: Host '[*.*.*.*]:50101' is known and matches the RSA host key.rndebug1: Found key in /Users/hugh/.ssh/known_hosts:1rndebug1: SSH2_MSG_NEWKEYS sentrndebug1: expecting SSH2_MSG_NEWKEYSrndebug1: SSH2_MSG_NEWKEYS receivedrndebug1: Roaming not allowed by serverrndebug1: SSH2_MSG_SERVICE_REQUEST sentrndebug1: SSH2_MSG_SERVICE_ACCEPT receivedrndebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-micrndebug1: Next authentication method: publickeyrndebug1: Offering RSA public key: /Users/hugh/.ssh/id_rsarndebug1: Server accepts key: pkalg ssh-rsa blen 279rndebug1: Authentication succeeded (publickey).rnAuthenticated to *.*.*.* ([*.*.*.*]:50101).rndebug1: channel 0: new [client-session]rndebug1: Requesting no-more-sessions@openssh.comrndebug1: Entering interactive session.rndebug1: Sending environment.rndebug1: Sending env LANG = zh_CN.UTF-8rndebug1: Sending env LC_CTYPE = zh_CN.UTF-8rnpacket_write_wait: Connection to *.*.*.*: Broken pipernrnrn请知道的人帮忙说下怎么解决, 感激不尽

没有更多推荐了,返回首页