Wenjian's Blog

Live and Learn

chmod 600 does not work as expected on Cygwin (Win8.1)

Recently I installed Cygwin on Win8.1.

When I try to ssh to my router in Cygwin terminal, it let me to input password.

In fact I am using private/public key files for ssh. Let us find what’s going on.

$ cd .ssh
$ ls -al
drwx------+ 1 wenjian None 0 9月 28 20:37 ./
drwxrwxr-x+ 1 wenjian None 0 9月 28 20:47 ../
-rw-rw-rw-  1 wenjian None 668 9月 9 2013 id_dsa

Got it. Try to fix it:

$ chmod -c 600 id_dsa
mode of "id_dsa" changed from 0666 (rw-rw-rw-) to 0600 (rw-------)
$ ls -al id_dsa
-rw-rw----  1 wenjian None 668 9月 9 2013 id_dsa

chmod 600 failed !!!

Here is the solution:

$ chgrp -R Users id_dsa
$ chmod -c 600 id_dsa
mode of "id_dsa" changed from 0666 (rw-rw----) to 0600 (rw-------)
$ ls -al id_dsa
-rw-------  1 wenjian Users 668 9月 9 2013 id_dsa

Leave a comment