0

I first came across this error when trying to write a program in Java that executes a .EXE that is packaged within the .JAR. At first I thought the issue was related to my program, or Windows 7 in general but after testing on two other Windows 7 machines, I can conclude that it is specific to my laptop.

Basically, I get an access denied message whenever I try to execute a program in "C:\Users\Andy\AppData\Local\Temp", even though I am using an Administrator account. I have looked at the permissions for the folder and there are only entries for Andy, and the Administrator, neither of which are inherited. And the check box that says inherit permissions from parent directory is disabled, and not ticked.

Any ideas what may be going wrong?

UPDATE: I've just logged in to the Built-In Administrator account and given my account ownership of the folder (I couldn't do it from my account), and now I can execute programs now. However, I would be interested in why this would have happened and how else I could have solved the issue.

Journeyman Geek
  • 127,463
  • 52
  • 260
  • 430
Andy
  • 481
  • 4
  • 12
  • 21
  • You need to adjust the permission on this folder. Try to take ownership of the folder. – Ramhound Sep 08 '13 at 18:25
  • @Ramhound How would I take ownership of the folder? – Andy Sep 08 '13 at 18:41
  • how you take ownership of a folder is well documented what have you tried? – Ramhound Sep 09 '13 at 11:12
  • @Ramhound I used the registry file found here to Take Ownership, but it hasn't changed anything at all. I did right click and select Take Ownership on the folder, and the CMD did show... http://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/ – Andy Sep 09 '13 at 18:00
  • If your using a reg file to tKe ownership of a folder your doing it wrong – Ramhound Sep 09 '13 at 18:31
  • 1
    @Ramhound I used the reg file to add the 'Take Ownership' option to the context menu, and then used that option on the folder. If this is wrong, can you please tell me the right way? – Andy Sep 09 '13 at 18:57
  • Properties Window on the folder. As to why this happen your past history of using registry hacks might have something to do with it either that a virus. – Ramhound Sep 09 '13 at 22:05
  • 1
    @Ramhound Surely even so I shouldn't have had to enable the hidden admin account to gain ownership though? I don't normally use registry hacks, and I'm sure that I haven't had a virus for a long time. – Andy Sep 10 '13 at 08:43
  • You are right its not normal. We cannot begin to guess the reasons you were unable to, an infection trying to protect itself from being removed, would be a logical reason. A malfunctioning peice of software is also another possability. If you have an answer to this question post it, instead of adding the answer to your question, as thats not the proper way to answer a question. – Ramhound Sep 10 '13 at 10:54
  • @Ramhound Fair enough, I suppose we can't really know the reason. I haven't added an answer yet because I wanted to see if anyone else could provide a good answer as to why this may have happened and all the possible solutions, but I will add my answer soon. – Andy Sep 10 '13 at 18:48

3 Answers3

6

There are some antivirus application that block execution from the temp folder. This is because this is a likely place for a virus to get downloaded into. The user has to explicitly move an executable out of the folder to run. It is an added layer of security.

Keltari
  • 71,875
  • 26
  • 179
  • 229
  • Thanks for your answer, I like the idea but in this situation, antivirus programs weren't the issue here. Useful answer for others though, and I clearly need to add a backup fail-safe location, so +1 – Andy Sep 12 '13 at 19:01
  • 2
    McAfee has this feature. The "C:\ProgramData\McAfee\DesktopProtection\AccessProtectionLog.txt" might have entries like this: "11/14/2014 11:57:35 PM Blocked by Access Protection rule CORP\username C:\ETC\PROCEXP\PROCEXP.EXE C:\Users\username\AppData\Local\Temp\PROCEXP64.exe Anti-spyware Maximum Protection:Prevent all programs from running files from the Temp folder Action blocked : Execute" – David Resnick Nov 14 '14 at 22:22
4

First of all, thank you to a @Ramhound for his helpful comments.

The issue was indeed due to ownership. However, the issue forced me to use the Built-In Administrator account in order to grant my 'standard' account ownership to the Temp folder. After that, everything worked fine.

Andy
  • 481
  • 4
  • 12
  • 21
0

I just saw the same thing on a Windows 8 computer. I suspect it may be that the ownership issue can happen if the user account being used is not the first account created on the machine. In my case the account being used is the second account created on this Windows 8 computer.

sjbotha
  • 971
  • 6
  • 6