Cygwin access denied

By jobeard
Mar 31, 2008
Topic Status:
Not open for further replies.
  1. On XP/Pro, \cygwin\bin\sed.exe gets Access Denied; Why?

    what am I missing?

    Code:
    Jeff@ltbeard /usr/bin
    	$ sed.exe -h
    	bash: /usr/bin/sed.exe: Permission denied
    
    yet cygwin perms are correct
    	$ ls -l sed.exe
    	-rwxrwxr-x 1 nMaster Users 97280 Aug  2  2006 sed.exe
    
    and XP ACLs look good (to me at least)
    C:\cygwin\bin>cacls ..
    C:\cygwin BUILTIN\Administrators:(OI)(CI)F
              NT AUTHORITY\SYSTEM:(OI)(CI)F
              <Account Domain not found>F
              CREATOR OWNER:(OI)(CI)(IO)F
              BUILTIN\Users:(OI)(CI)R
              BUILTIN\Users:(CI)(special access:)
                                FILE_APPEND_DATA
    
              BUILTIN\Users:(CI)(special access:)
                                FILE_WRITE_DATA
    
    C:\cygwin\bin>cacls .
    C:\cygwin\bin BUILTIN\Administrators:(OI)(CI)(NP)F
                  BUILTIN\Users:(OI)(CI)R
                  BUILTIN\Administrators:(OI)(CI)F
                  NT AUTHORITY\SYSTEM:(OI)(CI)F
                  LTBEARD\Jeff:F
                  CREATOR OWNER:(OI)(CI)(IO)F
                  BUILTIN\Users:(OI)(CI)R
                  BUILTIN\Users:(CI)(special access:)
                                    FILE_APPEND_DATA
    
                  BUILTIN\Users:(CI)(special access:)
                                    FILE_WRITE_DATA
    
    
    
    C:\cygwin\bin>cacls sed.exe
    C:\cygwin\bin\sed.exe LTBEARD\nMaster:(special access:)
                                          STANDARD_RIGHTS_ALL
                                          DELETE
                                          READ_CONTROL
                                          WRITE_DAC
                                          WRITE_OWNER
                                          SYNCHRONIZE
                                          STANDARD_RIGHTS_REQUIRED
                                          FILE_GENERIC_READ
                                          FILE_GENERIC_WRITE
                                          FILE_GENERIC_EXECUTE
                                          FILE_READ_DATA
                                          FILE_WRITE_DATA
                                          FILE_APPEND_DATA
                                          FILE_READ_EA
                                          FILE_WRITE_EA
                                          FILE_EXECUTE
                                          FILE_READ_ATTRIBUTES
                                          FILE_WRITE_ATTRIBUTES
    
                          BUILTIN\Users:R
                          Everyone:R
                          BUILTIN\Users:(special access:)
                                        WRITE_DAC
                                        SYNCHRONIZE
                                        FILE_WRITE_DATA
                                        FILE_WRITE_EA
                                        FILE_EXECUTE
                                        FILE_WRITE_ATTRIBUTES
    
    So why the permission errors?

    (and yes, I've reinstalled it twice; first just overlay the program,
    second, delete the program first (to clear the ACL) and then reinstall -- same error :( )
  2. Nodsu

    Nodsu Newcomer, in training Posts: 9,431

    It could be any of the DLLs or data files that sed is trying to access. Maybe run the file monitor from sysinternals and see which file access is denied.
  3. jobeard

    jobeard TS Ambassador Topic Starter Posts: 13,342   +297

    even just SED -H is denied, so it's not a data file. I fetch the F.M. and try that :)
  4. Nodsu

    Nodsu Newcomer, in training Posts: 9,431

    Also, I forgot the cool Linux (also in Cygwin) utility called strace that shows you what system calls a program uses and the results of these.
  5. jobeard

    jobeard TS Ambassador Topic Starter Posts: 13,342   +297

    cool -- I forgot that too. However ...
    $ strace -d -o ./strace.log /usr/bin/sed.exe
    strace: error creating process C:\cygwin/bin\sed.exe, (error 5)​
    while tracing LS works perfectly!

    The puzzle continues ...
  6. jobeard

    jobeard TS Ambassador Topic Starter Posts: 13,342   +297

    filemon results
    Code:
    09:50	bash.exe:1856	FASTIO_QUERY_OPEN	C:\cygwin\bin\sed.exe	SUCCESS	Attributes: A	
    09:50	bash.exe:1856	IRP_MJ_CREATE 	C:\cygwin\bin\sed.exe	SUCCESS	Options: [B]Open  Access: 00020080	[/B]
    09:50	bash.exe:1856	IRP_MJ_QUERY_INFORMATION	C:\cygwin\bin\sed.exe	SUCCESS	FileNameInformation	
    09:50	bash.exe:1856	IRP_MJ_QUERY_VOLUME_INFORMATION	C:\cygwin\bin\sed.exe	SUCCESS	FileFsVolumeInformation	
    09:50	bash.exe:1856	IRP_MJ_QUERY_INFORMATION	C:\cygwin\bin\sed.exe	SUCCESS	[B]FileAllInformation	[/B]
    [COLOR="Red"]09:50	bash.exe:1856	IRP_MJ_QUERY_SECURITY	C:\cygwin\bin\sed.exe	BUFFER OVERFLOW		[/COLOR]
    
    while other IRP_MJ_QUERY.. complete ok
    Code:
    09:50	bash.exe:1856	IRP_MJ_CREATE 	C:\cygwin\bin\sed.exe	SUCCESS	Options: Open  Access: 001000A1	
    09:50	bash.exe:1856	IRP_MJ_QUERY_INFORMATION	C:\cygwin\bin\sed.exe	SUCCESS	FileNameInformation	
    09:50	bash.exe:1856	FASTIO_QUERY_BASIC_INFO	C:\cygwin\bin\sed.exe	SUCCESS	Attributes: A	
    09:50	bash.exe:1856	FASTIO_QUERY_STANDARD_INFO	C:\cygwin\bin\sed.exe	SUCCESS	Length: 97280	
    09:50	bash.exe:1856	IRP_MJ_QUERY_INFORMATION	C:\cygwin\bin\sed.exe	SUCCESS	FileNameInformation	
    09:50	bash.exe:1856	FASTIO_QUERY_OPEN	C:\cygwin\bin\sed.exe	SUCCESS	Attributes: A	
    09:50	bash.exe:1856	FASTIO_QUERY_STANDARD_INFO	C:\cygwin\bin\sed.exe	SUCCESS	Length: 97280	
    09:50	bash.exe:1856	FASTIO_QUERY_STANDARD_INFO	C:\cygwin\bin\sed.exe	SUCCESS	Length: 97280	
    09:50	bash.exe:1856	IRP_MJ_QUERY_INFORMATION	C:\cygwin\bin\sed.exe	SUCCESS	FileNameInformation	
    09:50	bash.exe:1856	IRP_MJ_CREATE 	C:\cygwin\bin\sed.exe	SUCCESS	Options: Open  Access: Read	
    09:50	bash.exe:1856	FASTIO_QUERY_STANDARD_INFO	C:\cygwin\bin\sed.exe	SUCCESS	Length: 97280	
    09:50	bash.exe:1856	IRP_MJ_READ 	C:\cygwin\bin\sed.exe	SUCCESS	Offset: 0 Length: 8192	
    09:50	System:4	IRP_MJ_CLOSE 	C:\cygwin\bin\sed.exe	SUCCESS		
    
    is a puzzlement! (from the King & I)
  7. jobeard

    jobeard TS Ambassador Topic Starter Posts: 13,342   +297

    I give up

    I found a static linked version of sed in an archive name UnxUtils.zip

    I extracted ONLY sed.exe, stored it into /usr/local/bin and verified that it would run.
    rm -i /usr/bin/sed.exe then cleaned up the issue.

    I had previously attempted to reinstall sed frm the cygwin setup service, but to no avail, so I was forced into this approach.

    It drives me nuts to not understand what caused this, but sometimes you just have to move on :)
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.