"Permission denied" using cygwin on Windows

Background: I am trying to write a [.bat] file so that I can double-click it and the bash script is called. The bash script will launch several windowed graphics applications to monitor GPU / CPU temperature. I just did a fresh install of cygwin v1.7.7-1 (downloaded today) and Windows 7.

Code: monitor-temps.bat:

C:\cygwin\bin\bash.exe ~/bin/monitor-temps.bash pause 

Code: monitor-temps.bash:

 #!/usr/bin/bash "/cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe" & 

Conclusion: After I double-clicked the [.bat] file, I get:

 C:\Users\michael\Desktop>C:\cygwin\bin\bash.exe ~/bin/monitor-temps.bash C:\Users\michael\Desktop>pause Press any key to continue . . . /home/michael/bin/monitor-temps.bash: line 2: /cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe: Permission denied 

I still get the same permissions error when I connected to the directory and manually executed the application.

Access rights: From my experience with permission issues in Linux, everything looks good, because I am the user I think and the file has the expected permissions:

 $ whoami michael $ ls -l GPU* -rwx------+ 1 michael None 890720 2010-12-01 19:23 GPU-Z.0.4.8.exe 

Question: Does anyone know how to fix this? Did I miss something?

+8
windows-7 cygwin file-permissions
source share
7 answers

As a developer, I use a shortcut to create a command line interface (CLI), which behaves similarly to Linux in my Windows environment, and ran into the same problem trying to unlock the file.

Fixed: set the shortcut to "Run as administrator".

If you use this method to access the Cygwin environment, go to the properties of the shortcut, select the "Advanced" button to get the "Run as administrator" options, select the "OK" checkbox. And from you! You can also configure the batch file for this by making a shortcut for it and following the steps above.

Hope this helps!

+12
source share

I think you need to change the permission of the directory or file. If you want to change the resolution of a file or directory, you need to add the full path with the code.

As if you want to change the permissions on the cocos2d-x folder to C: \ yourDirectory (I am on Windows, on the Mac it will be / instead of \ ), write the code in the cygwin console:

 chmod -R 775 /cygwindrive/c/yourDirectory 
+9
source share

The easiest way to fix this:

  • Download Sysinternals ProcMon , run it and let it work for a while.
  • Exclude all processes that generate noise.
  • When the log becomes less busy, try to access the file.
  • Find the ProcMon log for Access Denied messages.
  • To explore. It should be easy to fix.
+5
source share

-rwx ------ + can be a problem. Some hidden acl may ban x for you. Reset your acl with setfacl, then.

 $ cat >/tmp/faclx <<EOF user::rwx group::r-- mask:rwx other:r-- EOF $ setfacl -f /tmp/faclx /cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe 

Or do you need elevated permissions:

 $ cygstart --action=runas /cygdrive/c/Users/michael/Desktop/apps_and_drivers/GPU-Z.0.4.8.exe 
+4
source share
  • Check the mount table with cat /proc/mounts or mount and make sure that every mount point from / , /usr/bin , /usr/lib has the noacl flag. If it is missing, fix /etc/fstab and reboot. (Reboot synchronized the noacl flag of the root mount point for me, and I don't know if this can be achieved without rebooting).

  • Check the NULL SID entry and other strange entries as a result of icacls output to a file. They appear when writing at the POSIX ACL translation level in Cygwin (using "noacl" in / etc / fstab allows you to disable this, but the damage will already be done).

    Resetting the Windows ACLs only in the file may not be sufficient if the contained parents had a NULL SID record. Need to run

     icacls c:\cygwin64 /reset /t /l /c 

    from the command line to remove extraneous entries from the Windows ACL in each file and directory.

Update Other commands reset ownership, remove default ACLs and show ACLs of a known binary before and after the changes:

 set croot=c:\cygwin64 icacls %croot%\bin\ls.exe %croot%\bin\getfacl /bin/ls takeown /F %croot% /R /DY > nul icacls %croot% /reset /T /C /L /Q icacls %croot%\bin\ls.exe %croot%\bin\getfacl /bin/setfacl %croot%\bin\getfacl /bin/find %croot%\bin\setfacl -bk /bin/find %croot%\bin\find -P / -xdev -exec /bin/setfacl -bk "{}" + icacls %croot%\bin\ls.exe %croot%\bin\getfacl /bin/ls 
+2
source share

I had this problem and installed it in cd in the directory that contains the box just created (packed or repackaged). Then vagrant box add <file.box> --name <name> . I think PATHs are all cheating, and make him fail. Then double check with vagrant box list . Then I mkdir coolbox; cd coolbox mkdir coolbox; cd coolbox . Then I just vagrant init <name> , and it all appears like magic.

0
source share

just change the scripting mode using the chmod command to make it executable. see man chmod for more details.

-one
source share

Source: https://habr.com/ru/post/650273/


All Articles