On Jun 23, 2016, at 4:21 AM, Andrey Repin <anrdae...@yandex.ru> wrote:
> 
> Greetings, Warren Young!
> 
>>> 2) Examining the permissions on putty.exe, the first thing that
>>> comes up is an error that reads:
>>> 
>>> "The permissions on putty.exe are incorrectly ordered, which may
>>> cause some entries to be ineffective.”
> 
>> That’s Explorer saying that, not Cygwin, right?  Let Explorer fix it.
> 
> Do NOT do that. It'll screw Cygwin permission handling.

Not necessarily.

If you can restrict Cygwin to a known set of directories, you can use 
Cygwin-only permissions in those directories and let Windows do whatever it 
wants with everything else.

Here’s my fixperms script, which keeps both sides happy:

    #!/bin/bash
    if [ -z "$1" ]
    then
        for d in /usr/local ~/bin ~/tmp
        do
                echo Fixing permissions in $d...
                chown -R $(id -nu) "$d"
                find "$d" -exec "$0" {} \;
        done
    elif ! setfacl -kb "$1"
    then
        echo "   ...in $1"
    fi

Modify the list of Cygwin-only directories at the top of the script to suit 
your local situation.

I don’t bother doing this to the entirety of c:\cygwin*.  I only include 
directories I’m likely to open in both Cygwin and Explorer in that list.

You might have to run it a few times to fix everything, due to the way Windows 
permission inheritance works.  (I prefer that to the alternative, which is the 
breadth-first find(1) hacks: http://stackoverflow.com/q/1086907)

You’ll probably also need to run it as Administrator, at least the first time.  
After that, new permission changes should be ones your user has the ability to 
revert without Admin level privileges.

If you’ve set your Cygwin HOME directory to be the same as your Windows user 
profile directory, be sure NOT to include ~ in the list of directories you 
modify with this script.  There are files under %APPDATA% at the very least 
that will break horribly if you run this on them.  Do this only on files that 
your user personally owns and uses, not files owned and used by Windows on your 
user’s behalf.

Directories you run this script on do not show the “incorrectly ordered” 
symptom in Explorer.
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to