Can't Access External HD To Change Security Permissions

Page 3 of 4 FirstFirst 1234 LastLast

  1. Posts : 2,752
    Windows 7 Pro x64 (1), Win7 Pro X64 (2)
       #21

    Well... looks like the earlier "guru" post I quoted from had mis-spelled the two commands it talked of.

    It's not "takedown". It is "takeown".

    Here is another more accurate and similar description and example, this time to take ownership of a specific system file in order to be able to delete it.

    ==================================

    You need to take ownership of the files, and then assign yourself rights to delete or modify the file. For this, we’ll use the command line.

    Open an administrator command prompt by typing cmd into the start menu search box, and hit the Ctrl+Shift+Enter key combination.





    To take ownership of the file, you’ll need to use the takeown command. Here’s an example:
    takeown /f C:\Windows\System32\en-US\winload.exe.mui
    That will give you ownership of the file, but you still have no rights to delete it. Now you can run the cacls command to give yourself full control rights to the file:
    cacls C:\Windows\System32\en-US\winload.exe.mui /G geek:F
    Note that my username is geek, so you will substitute your username there.


    At this point, you should be able to delete the file. If you still can’t do so, you may need to reboot into Safe Mode and try it again. For the filename in the example, I was able to overwrite it without safe mode, but your mileage may vary.


    NOTE: the CACLS command in the above [old] example has been replaced by ICACLS


    =======================================

    Here's another TAKEOWN example, taking ownership for a system folder and then giving permission to SYSTEM:

    takeown /f C:\Windows\System32\DriverStore\FileRepository\*.*

    cacls C:\Windows\System32\DriverStore\FileRepository\*.* /G System:F

    Note that the proper use of the CACLS command and its operands is very important.

    ========================================

    take ownership of a folder:

    Start a Command Prompt box (cmd) as administrator, and enter:

    takeown /f /r d:\test

    cacls d:\test /t /e /c /g username:F

    ==================================

    Official TAKEOWN command syntax:

    TAKEOWN [/S system [/U username [/P [password]]]]
    /F filename [/A] [/R [/D prompt]]

    Description:
    This tool allows an administrator to recover access to a file that
    was denied by re-assigning file ownership.

    Parameter List:
    /S system Specifies the remote system to
    connect to.

    /U [domain\]user Specifies the user context under
    which the command should execute.

    /P [password] Specifies the password for the
    given user context.
    Prompts for input if omitted.

    /F filename Specifies the filename or directory
    name pattern. Wildcard "*" can be used
    to specify the pattern. Allows
    sharename\filename.

    /A Gives ownership to the administrators
    group instead of the current user.

    /R Recurse: instructs tool to operate on
    files in specified directory and all
    subdirectories.

    /D prompt Default answer used when the current user
    does not have the "list folder" permission
    on a directory. This occurs while operating
    recursively (/R) on sub-directories. Valid
    values "Y" to take ownership or "N" to skip.

    /? Displays this help message.

    NOTE: 1) If /A is not specified, file ownership will be given to the
    current logged on user.

    2) Mixed patterns using "?" and "*" are not supported.

    3) /D is used to suppress the confirmation prompt.

    Examples:
    TAKEOWN /?
    TAKEOWN /F lostfile
    TAKEOWN /F \\system\share\lostfile /A
    TAKEOWN /F directory /R /D N
    TAKEOWN /F directory /R /A
    TAKEOWN /F *
    TAKEOWN /F C:\Windows\System32\acme.exe
    TAKEOWN /F %windir%\*.txt
    TAKEOWN /S system /F MyShare\Acme*.doc
    TAKEOWN /S system /U user /F MyShare\foo.dll
    TAKEOWN /S system /U domain\user /P password /F share\filename
    TAKEOWN /S system /U user /P password /F Doc\Report.doc /A
    TAKEOWN /S system /U user /P password /F Myshare\*
    TAKEOWN /S system /U user /P password /F Home\Logon /R
    TAKEOWN /S system /U user /P password /F Myshare\directory /R /A

    ==============================================

    Official ICACLS syntax:

    ICACLS name /save aclfile [/T] [/C] [/L] [/Q]
    stores the DACLs for the files and folders that match the name
    into aclfile for later use with /restore. Note that SACLs,
    owner, or integrity labels are not saved.

    ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile
    [/C] [/L] [/Q]
    applies the stored DACLs to files in directory.

    ICACLS name /setowner user [/T] [/C] [/L] [/Q]
    changes the owner of all matching names. This option does not
    force a change of ownership; use the takeown.exe utility for
    that purpose.

    ICACLS name /findsid Sid [/T] [/C] [/L] [/Q]
    finds all matching names that contain an ACL
    explicitly mentioning Sid.

    ICACLS name /verify [/T] [/C] [/L] [/Q]
    finds all files whose ACL is not in canonical form or whose
    lengths are inconsistent with ACE counts.

    ICACLS name /reset [/T] [/C] [/L] [/Q]
    replaces ACLs with default inherited ACLs for all matching files.

    [NOTE: in following examples, the items with smilies are actually : p]

    ICACLS name [/grant[:r] Siderm[...]]
    [/deny Siderm [...]]
    [/remove[:g|:d]] Sid[...]] [/T] [/C] [/L] [/Q]
    [/setintegritylevel Levelolicy[...]]

    /grant[:r] Siderm grants the specified user access rights. With :r,
    the permissions replace any previouly granted explicit permissions.
    Without :r, the permissions are added to any previously granted
    explicit permissions.

    /deny Siderm explicitly denies the specified user access rights.
    An explicit deny ACE is added for the stated permissions and
    the same permissions in any explicit grant are removed.

    /remove[:[g|d]] Sid removes all occurrences of Sid in the ACL. With
    :g, it removes all occurrences of granted rights to that Sid. With
    :d, it removes all occurrences of denied rights to that Sid.

    /setintegritylevel [(CI)(OI)]Level explicitly adds an integrity
    ACE to all matching files. The level is to be specified as one
    of:
    L[ow]
    M[edium]
    H[igh]
    Inheritance options for the integrity ACE may precede the level
    and are applied only to directories.

    /inheritance:e|d|r
    e - enables inheritance
    d - disables inheritance and copy the ACEs
    r - remove all inherited ACEs


    Note:
    Sids may be in either numerical or friendly name form. If a numerical
    form is given, affix a * to the start of the SID.

    /T indicates that this operation is performed on all matching
    files/directories below the directories specified in the name.

    /C indicates that this operation will continue on all file errors.
    Error messages will still be displayed.

    /L indicates that this operation is performed on a symbolic link
    itself versus its target.

    /Q indicates that icacls should supress success messages.

    ICACLS preserves the canonical ordering of ACE entries:
    Explicit denials
    Explicit grants
    Inherited denials
    Inherited grants

    perm is a permission mask and can be specified in one of two forms:
    a sequence of simple rights:
    N - no access
    F - full access
    M - modify access
    RX - read and execute access
    R - read-only access
    W - write-only access
    D - delete access
    a comma-separated list in parentheses of specific rights:
    DE - delete
    RC - read control
    WDAC - write DAC
    WO - write owner
    S - synchronize
    AS - access system security
    MA - maximum allowed
    GR - generic read
    GW - generic write
    GE - generic execute
    GA - generic all
    RD - read data/list directory
    WD - write data/add file
    AD - append data/add subdirectory
    REA - read extended attributes
    WEA - write extended attributes
    X - execute/traverse
    DC - delete child
    RA - read attributes
    WA - write attributes
    inheritance rights may precede either form and are applied
    only to directories:
    (OI) - object inherit
    (CI) - container inherit
    (IO) - inherit only
    (NP) - don't propagate inherit
    (I) - permission inherited from parent container

    Examples:

    icacls c:\windows\* /save AclFile /T
    - Will save the ACLs for all files under c:\windows
    and its subdirectories to AclFile.

    icacls c:\windows\ /restore AclFile
    - Will restore the Acls for every file within
    AclFile that exists in c:\windows and its subdirectories.

    [NOTE: in following examples the smilies are actually : (]

    icacls file /grant AdministratorD,WDAC)
    - Will grant the user Administrator Delete and Write DAC
    permissions to file.

    icacls file /grant *S-1-1-0D,WDAC)
    - Will grant the user defined by sid S-1-1-0 Delete and
    Write DAC permissions to file.

    ============================================
      My Computer


  2. Posts : 2,752
    Windows 7 Pro x64 (1), Win7 Pro X64 (2)
       #22

    Use "takeown" to access certain files

    Vista/7 protects many system files for security reasons and even an administrator may not allowed to access certain of them. If you are denied access to a file while in an administrator account, you can use the command line tool "takeown.exe" to reassign ownership. You will need to run the command from a command prompt with administrator privileges.

    The syntax is:
    takeown /f some_file [/a] [/r]
    The specified filename can contain wildcards. You can also specify a folder.

    The optional switch "/a" transfers ownership to the administrators group. If omitted, the default is to transfer ownership to the present user account.

    The switch "/r" recurses subdirectories. Although this command assigns ownership, it does not give control rights. Thus if you wish to modify a system file (often not a good idea) you will probably have also to apply the "icacls" command discussed next.


    Obtain control rights to a file with "icacls"

    (Icacls.exe supersedes the "cacls" command of Windows XP. The older command is still available, however.)

    This command has a rather complex set of options. They can be displayed by entering "icacls /?" in a command prompt.

    One example is the command to grant full access rights to an account named user:
    icacls file_name /grant user:F
    =========================================

    Takeown has more options than just /f, of course.

    To take ownership of an entire tree of folders and files, you can add the /r option. Thus, if you wanted to take ownership of a folder named C:\documents, as well as any files and folders inside C:\documents, you'd type
    takeown /f C:\documents /r
    If you've ever tried to take ownership of a tree of folders, you might have run into something of an annoyance—namely, Windows' tendency to ask if you really, truly want to take ownership.

    Suppose, for example, that you not only don't own C:\documents but you also don't have permission to look in C:\documents. In that case, taking ownership of C:\ documents wouldn't equip you to take control of any subfolders in C:\documents for the simple reason that although you would now own C:\documents, you would still lack the NTFS permissions necessary to list its subfolders.

    Feasibly, you could take ownership of each directory, one at a time, then add a list folders permission to that folder, which would let you see the subfolders in that folder, which in turn would let you take ownership of the subfolders.

    Thankfully, such manual labor isn't necessary: Whenever you use the /r option with Takeown, the command pauses at each folder and asks whether you'd like Takeown to add the list folders permission to that folder's NTFS permissions. That's a nice touch, but it means that taking control of a folder containing dozens of folders could get a bit tedious.

    The good news is that you can configure Takeown so that it doesn't ask you if you want to add the list folders permission and instead just assumes that you'll answer yes or no. To do that, you use the /d option, followed by a y or an n. So, to take ownership of C:\documents and all its subfolders, while granting yourself the list folders permission, you'd type
    takeown /f C:\documents /r /d y
    =========================================
      My Computer


  3. Posts : 15
    Windows 7 Ultimate
    Thread Starter
       #23

    More worthy instructions, thank you so much!


    Believe it or not Acronis is still backing up the drive. I let it run all night and now it's saying 20 more hours. I so want to get back to trying all you've suggested but figured it wouldn't hurt to have the drive backed up even if it is an image with permission access issues...just in case everything else fails. I actually started this backup after realizing the drive couldn't be read on another computer which wanted to reformat it. This could be a big waste of time (its beginning to feel that way) but I'm going to wait until it's done before charging ahead. After all, I've gone this far...*sigh.


    Thank you again for all the great suggestions....I still think I may try the Takeown first and appreciate the Command instructions. Its been ages since I've done any, so everything you've said is a big help.


    I'll be back soon as I can to report what worked or didn't work.
    Have a nice day.
    Last edited by mtnpoet7; 26 Feb 2012 at 16:03.
      My Computer


  4. Posts : 15
    Windows 7 Ultimate
    Thread Starter
       #24

    Dear DSPERBER,


    After re-reading your instructions for Takeown I just realized there may be another problem in trying to do this. Before I searched out this forum I did try a couple of basic commands in the ole command box and couldn't access the drive since it doesn't have a letter showing anymore because it can only be seen in the Network.

    Therefore my question is, can these commands be done starting with something like //touch-pc/NAME of Drive ?

    Or how do I write this starting with c:/ in the command box?

    If memory serves I couldn't access the drive by command even when I could see a drive letter, though at that stage of this mess I may have typed the command wrong. In any case, can I get to the drive even when it isn't showing up in My Computer?

    Instead of pulling out all my hair today, I think I'll take to smashing my forehead on to my desk, ha. This is a poet's poor attempt at trying to keep a sense of humor
      My Computer


  5. Posts : 2,752
    Windows 7 Pro x64 (1), Win7 Pro X64 (2)
       #25

    mtnpoet7 said:
    After re-reading your instructions for Takeown I just realized there may be another problem in trying to do this. Before I searched out this forum I did try a couple of basic commands in the ole command box and couldn't access the drive since it doesn't have a letter showing anymore because it can only be seen in the Network.

    Therefore my question is, can these commands be done starting with something like //touch-pc/NAME of Drive ?
    Well, we're now sailing in uncharted territory. I, myself, have never used these particular commands.

    Hunting around for yet more outside world experience, I get a slightly different more compact and not quite as verbose presentation from a MS site, which talks about using an IP address and NOT using back-slash in the "remote system" specification area, when using the /S
    operand. So it would seem you can't use the conventional backslash-dependent network-type notation for your drive that has-no-local-letter.




    Then there is another example actually using the /S parameter, but specifying LOCALHOST as the system, which seems to be a way to identify the local machine itself if I interpret it properly, without actually using a drive letter:

    takeown /s localhost /u "NT Service/TrustedInstaller" /f "%windir%\winsxs\Catalogs"

    which asks for trustedinstaller password, which generates randomly

    followed by:

    icacls "%windir%\winsxs\Catalogs" /setowner "NT Service\TrustedInstaller" /T /C

    But to be honest, I don't know how it might be specified in your situation, where this locally attached drive is not assigned a drive letter.


    Then, there's my NovaBackup idea, which has the ability to specify items to be backed up either as (a) local objects, from drives with drive letters, (b) network objects, from network items mapped with drive letters, and als (c) network objects, from generally accessible network shares... both drives and folders.



    But again, whether even NovaBackup BACKUP can access anything on this problem drive (assuming it can even see it or its folder contents) since the permissions are in trouble and it's a local device with no drive letter, even if you UN-CHECK the "backup ACL permissions" item on the BACKUP job definition so that the problem permissions will be dropped on the output backup, well I honestly couldn't say.


    Uncharted territory, I'm afraid.

    If anybody else is following this thread (any longer) who has experience with TAKEOWN, now would be the time to chime in.
      My Computer


  6. Posts : 10,485
    W7 Pro SP1 64bit
       #26

    I suggest that you finish trying the steps mentioned in this earlier post.

    Select (or add) Administrators.
    Attached Thumbnails Attached Thumbnails Can't Access External HD To Change Security Permissions-owner.jpg  
      My Computer


  7. Posts : 2,752
    Windows 7 Pro x64 (1), Win7 Pro X64 (2)
       #27

    UsernameIssues said:
    I suggest that you finish trying the steps mentioned in this earlier post.

    Select (or add) Administrators.
    Unfortunately, she no longer sees the drive as a local drive letter in Explorer. It's only visible on the Network view.

    But the same Properties -> Security tab -> Advanced, etc. approach appears available even for network objects. So I agree, this approach could actually work even with the obstacle of the drive not being a local drive letter.

    TAKEOWN does seem to be something that has even more capability for Power Users, and perhaps was intended to be used as a true "last resort" with ultimate capability to reclaim drive/folder/file ownership rights.
      My Computer


  8. Posts : 15
    Windows 7 Ultimate
    Thread Starter
       #28

    Greetings Dsperber (& others),


    Thanks for the additional suggestions. After over a day and a half I am unhappy to report the Acronis image failed while I was away from the computer. It had been doing just fine a few hours before, but then it terminated the job. so I was right earlier today that this image backup attempt was a colossal waste of time.

    But moving on... I'm going to read through all of the suggestions again to make sure I understand what to do, and then try them all one by one.


    I'm forever grateful for all the help even if none of it works out because this process at least gave me hope, which is more than I had when I first arrived here. So hoperfully by tomorrow we'll know whether a 15 year backup project can be saved or not. My fingers are crossed...
      My Computer


  9. Posts : 15
    Windows 7 Ultimate
    Thread Starter
       #29

    Greetings Dsperber,

    After several days of working on this mess of mine I had to go back to work this past week or so. Today I'm still in the process of moving and backing up several external hard drives so I have room to try and back up the messed up drive which has about 1.5 TB of data on it.

    Just creating space for this has taken more time than expected, but I shall be much better organized when I'm done as I have a lot of duplication between drives having never taken the time to remove all the duplicates, or in some cases triplicates. Though this was how all my music ended up on one external hard drive in the first place.

    In the meantime I do like that software you recommended NovaBackup. It's definitely superior to Acronis in many respects and is helping me work with other backup drives while I prepare to try and back up the drive only seen in my network.

    Anyone else reading this thread...I will report whether or not I am successful or in the end just have to bite the bullet and reformat the drive. It just might take awhile longer. My fingers are still crossed (thanks to you).

    Thanks for recommending Novabackup!

    dsperber said:
    UsernameIssues said:
    I suggest that you finish trying the steps mentioned in this earlier post.

    Select (or add) Administrators.
    Unfortunately, she no longer sees the drive as a local drive letter in Explorer. It's only visible on the Network view.

    But the same Properties -> Security tab -> Advanced, etc. approach appears available even for network objects. So I agree, this approach could actually work even with the obstacle of the drive not being a local drive letter.

    TAKEOWN does seem to be something that has even more capability for Power Users, and perhaps was intended to be used as a true "last resort" with ultimate capability to reclaim drive/folder/file ownership rights.
      My Computer


  10. Posts : 218
    Windows 7 Home Premium x64
       #30

    Well Cynthia, I hope you were eventually able to get the permissions straightened out. I'm expecting you did, because you didn't come back for more help.


    I ran into a similar problem on my system, where I docked a hard drive in my optical bay that contained a full install of a Windows Vista OS. When I tried to access any files under "users", I was denied. Seriously frustrating. Windows apparently does not distinguish between internal and external drives when it comes to security. If I'm an administrator and an internal drive exists, I should have access even if it's READ ONLY.

    Well, what I needed to do was explicitly add my user name (Cytherian) with granted permissions to the folder. I could not drill down further to specify exactly which ones, so I was forced to apply this to ALL files under the user. This was annoying as all hell, because I was greeted with hundreds of "Access Denied" modal dialogs that demand a response to continue, so I couldn't walk away.

    Thankfully after cancelling the change, whatever had already been applied granted me read access, so I could drill down to the folders I wanted to copy. I wonder if there's a "clean" way to do this, though.


    Microsoft really didn't seem to think this security model through when it comes to this kind of situation, of adding a physically attached drive to the computer.
      My Computer


 
Page 3 of 4 FirstFirst 1234 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:00.
Find Us