There seems to be a bug in Win32-OpenSSH that prevents colors to be shown in certain terminal emulators such as PuTTY and mintty.

Win32-OpenSSH seems to replace the color escape sequence "\033[32m\033[40mtest" by "\033[0;39;24;27;32;40;mtest" and the problem seems to be the last semicolon before the m. Removing this semicolon, the colors are displayed correctly.


I installed Win32-OpenSSH-Win64 (version according to https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH.

I set

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH\DefaultShell="C:\Program Files\GIT\bin\bash.exe"  


Logging into my machine with

ssh localhost

I do not get color output with PUTTY, and not with "Git Bash for Windows" but I do get colors with the native "cmd.exe" and with "Bash on Ubuntu on Subsystem for Linux" connecting to the same local server.

The problem seems to be related to unusual escape sequences. Logging all session output in PuTTY shows escape sequences that are terminated by a semicolon: "\033[0;39;24;27;32;40;mtest" and PUTTY does not seem to be able to handle them. Escape sequences without the final semicolon, e.g., "\033[0;39;24;27;32;40mtest" are handled correctly by PUTTY.

Those unusal escape sequences seem to be introduced by Win32-OpenSSH. In contrast, the Bitvise SSH Server produces the escape sequence "\033[32m\033[40mtest".

  • 3
    PuTTY actually interprets them correctly -- an empty parameter is equivalent to 0, which unfortunately happens to mean "reset all formatting". (In other words, \033[0;39;24;27;32;40;mtest is equivalent to \033[0;39;24;27;32;40;0mtest which collapses down to \033[0mtest.) I suggest sending a bug report to the WSL developers. – grawity Dec 29 '17 at 10:24
  • So the issue seems to be with OpenSSH. Is there a way to prevent OpenSSH from adding the final semicolon? – David Dec 29 '17 at 15:35
  • Again, sounds like a bug in the Windows' OpenSSH port. (And the fact that WSL shows colors would probably indicate a bug in WSL as well.) – grawity Dec 29 '17 at 16:00

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.