Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

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.

share|improve this answer
    
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. –  LLM Sep 13 '12 at 7: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 7:58

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
share|improve this answer
    
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 –  LLM Sep 13 '12 at 9:20
    
Try takeown /f C:\home\Program.cs /r /a in the same administrative command prompt. –  Ansgar Wiechers Sep 13 '12 at 9:45

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.
share|improve this answer
    
I tried the same but still access is denied. –  LLM Sep 13 '12 at 9:23
    
@LLM see update. –  HopelessN00b Sep 13 '12 at 9:38
    
Use icacls. It's far more versatile than cacls or xcacls. –  Ansgar Wiechers Sep 13 '12 at 9:50
    
The file and root folder was not locked, i checked it with unlocker utility. I also tried run as administrator but no luck. File shows READ ONLY to all, –  LLM Sep 13 '12 at 12:41
    
@LLM Then clear the tick box so that it's NOT read only first, and then take ownership and/or change permissions. –  HopelessN00b Sep 13 '12 at 23:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.