Loading... # 使用 Mosh 来代替不稳定的 ssh ## 安装 Mosh 1. Debian、ubuntu 使用 apt-get ```bash apt-get update apt-get install mosh ``` 2. centos 、 RHEL ```bash yum update yum install mosh ``` 3. mac os ```bash brew install mosh brew install --HEAD mosh #安装git最新版本 ``` ## Mosh 设置 > mosh 使用的是 60001 UDP 端口,所以服务器需要开启 UDP 端口连接 > UDP 端口从 60000 到 61000 1. 使防火墙允许此端口出入 ```bash iptables -I INPUT -p udp --dport 60001 -j ACCEPT ``` ## mosh 连接 ```bash # 如果原来连接服务器是采用密码的方式登录,会提示输入密码,如果ssh已经做好了密钥认证,则可以直接连接 mosh -p 60001 用户名@ip地址 ``` Last modification:September 3, 2022 © Allow specification reprint Support Appreciate the author AliPayWeChat Like If you think my article is useful to you, please feel free to appreciate