MacOS – ssh terminal window closes immediately when opened

macossshterminal

I am seeing some odd behavior when using the Terminal app to open an ssh window to a remote machine. I normally connect to many different Linux servers from my MacBook Pro running Mac OS X 10.7.3, with Terminal 2.2.2 (303).

I have a list of the servers' IP addresses in the New Remote Connection window's ssh group. When I select one of the servers (10.x.y.120, for instance), enter a username, and click Connect, an ssh window opens and I can enter my password and get to work.

However, starting yesterday, for a couple of the machines (10.x.y.182 and 10.x.y.194), when I follow this procedure an ssh window opens and then immediately disappears. For other servers, the window opens as usual.

Here's the kicker: If I open a terminal window on my MacBook Pro itself, then run ssh on the command line to the machine that I can't reach through the New Remote Connection window, the connection works perfectly. It only fails when I do it through Terminal.

I have tried deleting the entry in New Remote Connection, and creating it again, but that didn't help. This is happening on a machine that was just restarted. One thing that did change was that I applied the latest Mac OS updates over the weekend. I don't remember which versions they were.

Things used to work last week, so something broke recently. Are there any logs I could look at for more information? Are there any configuration or data files that might have become corrupt? Thanks in advance for your help.

Best Answer

Here's what happened. On the machines I was trying to reach (10.x.y.182 and 10.x.y.194), in the time when I was not using them they had their hard disks replaced and the OS reinstalled. This gave them new SSH keys, invalidating the ones I had in my ~/.ssh/known_hosts file. Unfortunately, Terminal.app did not surface this problem to me.

By deleting the entries for those machines in ~/.ssh/known_hosts, I forced the system to pull down the new keys and ask me if I wanted to use them. With this done, connections worked perfectly as usual. Oddly, however, even before I changed ~/.ssh/known_hosts, connections using the DNS name of the machine (svr10 and svr20) worked. Weird.

Thanks, everyone, who looked at this problem.