Mac下用iterm操作远程服务器
1.连接
ssh -t root@公网ip地址 -p 22(端口号)
2.出现了broken price的现象
这属于丢包现象
解决方案
情景一:如果您有多台服务器,不想在每台服务器上设置,如下操作:
1、运行命令:
cd ~/.ssh/
2、假如运行命令ls,没有config,新建config
vim config
3、在config在里面输入:
ServerAliveInterval 60
4、保存文件(:x)
在链接linux服务器,就不会有断线的问题了。
情景二:如果您有多个人管理服务器,不想在每个客户端进行设置,只需在服务器的 /etc/ssh/sshd_config 中添加如下的配置:
ClientAliveInterval 60
情景三:如果您只想让当前的 ssh 保持连接,可以使用以下的命令:
ssh -o ServerAliveInterval=60 user@sshserver
3.如果服务器被重新恢复那么连接会报错
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:vqZKpmZf6/mQwdhkCbQwv8qIGQ7XRprxtGdEP3AVa9Y.
Please contact your system administrator.
Add correct host key in /Users/hope/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/hope/.ssh/known_hosts:1
ECDSA host key for 39.107.28.55 has changed and you have requested strict checking.
Host key verification failed.
解决办法:
ssh-keygen -R 服务器ip地址
通往牛逼的路上,在意的只有远方!