"tty" option detected in CYGWIN environment variable

I recently reinstalled cygwin on my windows 7 machine, and added the cygwin directory to my path so that it works seamlessly with the windows command line. Every time I execute a command, I get the following above the actual output:

"tty" option detected in CYGWIN environment variable.
CYGWIN=tty is no longer supported.  Please remove it from your
CYGWIN environment variable and use a terminal emulator like mintty,
xterm, or rxvt.

How can I get rid of this so that I can use cygwin in my command line without the annoying header?


Solution 1:

I had the same issue, but there was no setting for the CYGWIN environment variable in any script or in the computer properties (Control Panel).

I then discovered that the sshd service had a setting for the CYGWIN environment variable in the Windows registry under the following key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\sshd\Parameters\Environment

By removing the tty option in the @CYGWIN string, the deprecation warning no longer appears when executing commands.

Solution 2:

You must have the CYGWIN environment variable set somewhere, e.g. in a script you're using to start your command prompt or in the global Windows environment. You can find the latter in the Control Panel, under System->Advanced->Environment Variables. (At least that's where they are in XP; they might have moved in 7.)

Solution 3:

+1 for VirtualStaticVoid

You can see the setting here:

$ cat /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/services/sshd/Parameters/Environment/CYGWIN
tty ntsec

But it is read only. Here is how to fix it with only ssh access:

Create sshd-env.reg

$ cat <<EOF >sshd-env.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\sshd\Parameters\Environment]
"CYGWIN"="ntsec"
EOF

Import it into the registry:

$ regedit.exe -s sshd-env.reg

Verify it took:

$ cat /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/services/sshd/Parameters/Environment/CYGWIN
ntsec

Somehow restart sshd.

Seems cygrunsrv doesn't have a --restart option. Shame. Without crontab installed, which it isn't by default, it might be easiest to reboot the machine. It is windows, after all.

$ shutdown -r -t 0