环境:
mac pro: big sur version: 11.2.3 M1
问题:
使用终端terminal 通过 ssh 登录云服务器,输入正确密码后,退出并报错:
client_loop: send disconnect: Broken pipe
但是使用secureCrt 可以成功登录远程服务器。
关于以上问题,网上有很多相关资料,大同小异。
该问题估计与默认的Big Sur OpenSSH 以及 LibreSSL 版本有关。
步骤:
1、安装openssh
brew install openssh
2、添加配置
打开 ~/.ssh/config,追加以下配置
vim ~/.ssh/config
配置内容
Host *
IPQoS none
TCPKeepAlive no
ServerAliveInterval 60
ServerAliveCountMax 5
保存然后退出。
再尝试 ssh 远程服务器,成功。
ssh -V
OpenSSH_8.1p1, LibreSSL 2.7.3
1、 安装openssh 报错:Not a Valid Keg Error
处理
brew install nvm
2、 解释
2.1 ServerAliveCountMax: 断开时重试连接的次数
2.2 ServerAliveInterval: 每隔 n 秒自动发送一个空的请求以保持连接
2.3.TCPKeepAlive:
Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying. The default is yes (to send TCP keepalive messages), and the client will notice if the network goes down or the remote host dies. This is important in scripts, and many users want it too. To disable TCP keepalive messages, the value should be set to no. See also ServerAliveInterval for protocol-level keepalives.
2.4 IPQoS:
Specifies the IPv4 type-of-service or DSCP class for connections. Accepted values are af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, ef, le, lowdelay, throughput, reliability, a numeric value, or none to use the operating system default. This option may take one or two arguments, separated by whitespace. If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is af21 (Low-Latency Data) for interactive sessions and cs1 (Lower Effort) for non- interactive sessions.
参考:
rsync / git / ssh problem macos 11.3.1 / Big Sur
https://stackoverflow.com/questions/67522915/rsync-git-ssh-problem-macos-11-3-1-big-sur
https://man7.org/linux/man-pages/man5/ssh_config.5.html