1 | # 直接连接 |
1 直接连接
1 | # ssh -p 端口号 服务器用户名@ip地址 |
2 通过代理连接
- 直接连接
1 | # ssh -o ProxyCommand="nc -X 5 -x 代理服务器ip:代理服务器端口 %h %p" 需要访问的服务器的用户名@需要访问的服务器ip |
- 使用SSH配置文件
1 | sudo vi ~/.ssh/config |
1 | Host * |
配置好了之后就可以和直接连接一样使用
1 | ssh uesr@ip |
Mac下SSH跳点连接及代理连接_Dawnworld-CSDN博客_mac ssh 代理
https://blog.csdn.net/thundon/article/details/46858957
3 Keep alive
方案一:
在本机 vim ~/.ssh/config
1 | # 在开头添加 |
我觉得60秒就好了,而且基本去连的机器都保持,所以配置了*
,如果有需要针对某个机器,可以自行配置为需要的serverHostName
。
方案二:
单次连接
添加下面的参数
1 | ssh -o ServerAliveInterval=30 user@host |