Cygwin Tips

From EggeWiki
Revision as of 19:10, 10 December 2011 by Brianegge (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Word Splitting

Cygwin CVS

I was getting this error.

$ cvs up
/CVSROOTccess /usr/local/cvsroot
No such file or directory

I found this [solution]:

find . -name Root -or -name Entries -or -name Repository | while read file; do dos2unix.exe "$file"; done

Cygwin File Permissions

I kept getting this problem with Cygwin. I've never had this problem with non-domain accounts, or where my home directory is on my local hard drive:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0444 for '/cygdrive/z/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /cygdrive/z/.ssh/id_rsa

I would try every combination of chmod and Windows permissions without any luck.

brian@windoze ~
$ ll /cygdrive/z/.ssh/id_rsa
-r--r--r-- 1 brian Domain Users 1675 Sep 12 10:07 /cygdrive/z/.ssh/id_rsa

brian@windoz ~
$ chmod 400 /cygdrive/z/.ssh/id_rsa

brian@windoz ~
$ ll /cygdrive/z/.ssh/id_rsa
-r--r--r-- 1 brian Domain Users 1675 Sep 12 10:07 /cygdrive/z/.ssh/id_rsa

Fortunately I found this solution:

Cygwin can emulate more Unix-like file permissions but it is not enabled by default. One has to add "ntea" to CYGWIN variable in the cygwin.bat file in the cygwin root directory, which tends to be C:\cygwin. For example I have:
set CYGWIN=tty ntea
in C:\cygwin\cygwin.bat
With this, "chmod 0600 .id_rsa" works as in Unix. ssh stopped complaining and I could ssh w/o entering a password.

Thanks to "Teruhiko Kurosaka" for this tip.

brian@windoz ~
$ ll .ssh/id_rsa
total 34
-r--r--r-- 1 brian Domain Users 1675 Sep 12 10:07 id_rsa

brian@windoz ~
$ chmod 400 .ssh/id_rsa

brian@windoz ~
$ ll .ssh/id_rsa
total 34
-r-------- 1 brian Domain Users 1675 Sep 12 10:07 id_rsa

What matters is really what kind of file system your home directory is on. It's usually either:

  • Local disk
  • SAMBA share
  • Netapp

Local disk should work with the Cygwin defaults, but for SAMBA types, it usually requires some tweaking. If you can't get anything to work, it very might well be that your home directory is world-readable. This happened to me after the Windows server guys moved my home drive over a weekend.

My addition tip is to put CYGWIN=tty ntea in your Windows environment variables so [rxvt] works just as well. IMHO [rxvt] should be the default exe for Cygwin, as it's much friendlier than the cmd.exe which Cygwin normally runs in.