Sunday, March 25, 2012

Mac Lion: ssh hangs

Symptom:

On Mac Lion (10.7.3), when you try 'ssh' it times-out. You know you have the proper login and host parameters because it works from other computers (say Linux or Windows putty, or even running putty on the same Mac!)

Cause:

I do not know, but it appears that the Mac Lion SSH handles UTF-8 character sets in the manner that the remote side do not like.

There is nothing wrong with your network or network provider. Something wrong is introduced in Lion.

Fix:

Essentially finding a line in /etc/ssh_config file that says LANG LC_* should just be commented out. If you do not know exactly what I am talking about the following is the steps to accomplish this.

  1. Open Terminal
  2. sudo vim /etc/ssh_config
  3. Supply your password
  4. Type in below, including the first /
  5. /LANG LC_
  6. This will take you to the line where the problem is
  7. Hit the left arrow key several times,  until you are at the start of the line.
  8. Type i to insert
  9. Type # to comment out the line
  10. Press ESC to exit the insert mode
  11. Type wq (means write quit) to save the file and exit vim
  12. Now close the Terminal, Re-launch it and try ssh again
If you do not want to all of this, simply download other SSH clients and use them.