iTerm2 ssh 出现诡异现象,求小伙伴支招,来来来~

2016-06-23 23:34:14 +08:00
 publicAdmin

ssh server1 连接成功, 断开, ssh 连接 server2 , 结果被重置连接上 server1,且自动跳过输密码步骤。 哪怕完全退出 iTerm2,再次启动 ssh 还是重置,蛋遂。 遂考虑用自带终端 ssh 连接,发现依然一样,怀疑是不是 zsh 哪里配置作祟。 找不到原因.不晓得有无小伙伴知晓如何解决?万分感谢!

2287 次点击
所在节点    Apple
7 条回复
Citrus
2016-06-23 23:38:23 +08:00
用的 IP 还是域名?是否有 Hosts ?
xfwduke
2016-06-23 23:43:20 +08:00
ssh -vvv $server_addr

看下详细日志就知道发生了什么
publicAdmin
2016-06-23 23:51:11 +08:00
@Citrus ip, 你是说 /etc 下的 hosts 文件吗?有的。
@xfwduke 感谢,马上尝试
publicAdmin
2016-06-23 23:57:37 +08:00
@xfwduke

```
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/tory/.ssh/config #为了使用不同私钥登录我在这个 config 文件指定了映射
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for * #好像是这句
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 41395
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 6
Last login: Thu Jun 23 23:48:36 2016 from 192.168.0.130

```
这个是我连接 server2 的时候产生的。
有点儿看不懂。/囧。
xfwduke
2016-06-24 00:01:16 +08:00
会不会是你在 .ssh/config 里面把 2 个别名指向同一台 server 了
publicAdmin
2016-06-24 00:01:40 +08:00
@xfwduke 感谢启发,发现过程中在加载 config 配置,我把不是手动添加的部分注释掉,链接正常了.
#ControlMaster auto -----应该是这步
#ControlPath /tmp/git@git.oschina.net:22
#ControlPath /tmp/git@github.com:22
#ControlPersist yes
wd
2016-06-24 05:38:14 +08:00
不同服务器 controlpath 得不同啊 你写死要怎么?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/287925

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX