ssh和scp连接断开处理
由于长时间未操作导致ssh连接断开或文件输出时间过长scp连接断开,可通过发送“心跳包”的方式防止会话超时。
ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=4 root@服务器IP -p 端口
scp -o ServerAliveInterval=30 -o ServerAliveCountMax=10 -P 端口 本地文件 用户名@服务器IP:目标路径
由于长时间未操作导致ssh连接断开或文件输出时间过长scp连接断开,可通过发送“心跳包”的方式防止会话超时。
ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=4 root@服务器IP -p 端口
scp -o ServerAliveInterval=30 -o ServerAliveCountMax=10 -P 端口 本地文件 用户名@服务器IP:目标路径