1. Mosh简介, 及为什么要使用Mosh

1. Mosh全称Mobile Shell, 移动远程终端应用程序. 与ssh类似, 却有很多新功能,
可以漫游, 支持间歇性连接, 这对网络延迟高或者移动使用更换IP非常友好,
2. 我的服务器是VPS, 在使用SSH过程中, 经常会中断, 频繁重新连接, 还要kill掉之前的终端.
Mosh的用法与SSH一致, 无缝切换.

2. Mosh 安装. 需要服务器端和客户端都安装软件. 服务端安装脚本

1. 服务器端安装mosh, 并开启防火墙udp端口

yum -y install epel-release
yum -y install mosh

firewall-cmd --zone=public --permanent --add-port=60000-61000/udp

firewall-cmd --reload

2. 本地安装

Mac:

brew install mosh

Windows: 参考

3. Mosh使用.

使用规则与ssh一致.

# 帮助
mosh -h

# 连接
mosh [email protected]

# 使用ssh config配置连接
mosh locale_centos7

ssh config配置可以参考这里

或者这里