-1

I have a scripts which download files from my file server and extract it on c:\home folder @ Windows Server R2.

When I tried to edit and save the extracted files, it shows Access denied, I am able to create new files under it.

I tried to edit the permission but they are locked, Administrator also not able to change permission.

So please let me know whats the issue.

Thanks, Laxmilal

3 Answers3

1

The issue is "bad" permissions on the file or folder ACL.

To workaround that, the easiest solution in Windows is to take ownership of the file or folder.

I'll go out on a limb and assume that the GUI would be most appropriate way to show you how to resolve this, so as below...

(Follow links for screenshots)

  1. Right click on the file or folder in question, and select Properties.
  2. Select the Security tab.
  3. Click Advanced and go to the Owner tab.
  4. Change the current owner to the administrative group or user, hitting Edit to do so if UAC is enabled.
  5. If it's a folder object, make sure the Replace owner on subcontainers and objects box is ticked.
  6. Hit Apply and close out of all properties tabs.
  7. You will now be able to change the permissions on the object to delete it.

UPDATE:

In response to your comment about it not working through the GUI:

  1. Is the file or folder "locked?" If you're getting that error, you can't modify the file because some process is currently using it, preventing anything from changing the file. Your options are to find the process and kill it (through Task Manager, for example), or remove the locking handle, for which I prefer Unlocker).
  2. If it's not a locked file issue, you should probably use the Windows CLI to change the permissions. Launch cmd.exe "elevated" (Right Click -> Run as Administrator). The best Windows CLI utilities for this task are XCACLS, for which you can find a good use guide here and CACLS, for which the you can find a good use guise here.
HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
0

Have you tried to take over ownership of these files?

What user account runs the script that downloads these files? Normally the owner of the files is the creator.

Datapimp23
  • 191
  • 1
  • 3
  • 21
  • Ownership options are disabled. I am downloading files using python scripts and the python scripts called by Windows Service. Windows Service installed using Administrator account. – Laxmi Lal Menaria Sep 13 '12 at 07:38
  • @LLM Uh, no. There's no such thing as "disabling ownership" ... I guess I'll punch up an answer with instructions. – HopelessN00b Sep 13 '12 at 07:58
0

Is UAC enabled on the system? In that case, even when you log in with an admin account, that account is unprivileged until you explicitly request elevated privileges (via "run as Administrator"). Can you start a command prompt "as Administrator" and change permissions with icacls?

icacls C:\YOUR\EXTRACTED\file /grant "Authenticated Users:(CI)(OI)F
Ansgar Wiechers
  • 4,247
  • 2
  • 18
  • 26
  • I tried the same but giving error: Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Administrator>icacls C:\home\Program.c s /grant "Authenticated Users:(CI)(OI)F C:\home\Program.cs: Access is denied. Successfully processed 0 files; Failed processing 1 files – Laxmi Lal Menaria Sep 13 '12 at 09:20
  • Try `takeown /f C:\home\Program.cs /r /a` in the same administrative command prompt. – Ansgar Wiechers Sep 13 '12 at 09:45