0

I accidentally changed file ownership of a folder in Windows 7 and now nobody can edit, copy, view, move it, etc. Not even the administrator account account can change it back.

I tried icacls and takeown in elevated command prompt in Windows 7 but that didn't work.

takeown /f \\SERVER\foo\bar\misc\ /a /r /d y

/icacls \\SERVER\foo\bar\misc\ /grant administrator:F SYSTEM:F everyone:F

Then I tried chown and chmod in Kali/Ubuntu and it keeps saying No such file or directory found.

sudo chown -R root smb://server/foo/bar/misc

Is there a way Kali-Linux or Ubuntu can override the ownership? Or maybe I'm missing a different way in Windows? The properties tab for the folder doesn't change, its greyed out, in a sense. The folder I need to change is located in a network server. (\\SERVER\foo\bar\misc)

1
  • You should try to fix this on the server. Commented Jul 28, 2015 at 1:39

1 Answer 1

1

In the local mode, Administrator can change the ownership of any file/folder even he wasn't owner of files:
To take ownership of a file or a folder, follow these steps:

  1. Right-click the folder that you want to take ownership of, then click Properties.
  2. Click the Security tab, click Advanced, then click the Owner tab.
  3. Click Edit.
    Note: If you are prompted for an administrator password or for confirmation, type the password or provide confirmation.
  4. Click the name of the person that you want to give ownership to.
  5. If you want this person to be the owner of files and subfolders in this folder, select the Replace owner on subcontainers and objects check box.
  6. Click OK.

After that if you don't have appropriate permission:
1. Right-click the file or folder, then click Properties.
2. Click the Security tab.
3. Under Group or user names, click your name to see the permissions that you have.

To open a file, you have to have the Read permission. To change permissions on a file or folder, follow these steps.

Important You must be logged on as an administrator to change permissions on files and folders.

  1. Right-click the file or folder, and then click Properties.
  2. Click the Security tab.
  3. Under Group or user names, click your name to see the permissions that you have.
  4. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.
2
  • Unfortunately I have already tried to change it via the properties window. When I try to change it to Everyone or Administrators or SYSTEM, all it says is Access is denied and reverts itself back
    – ECHELON
    Commented Jul 28, 2015 at 5:31
  • I've changed owner of files, folders many time even I was not the owner of file with the solution mentioned above. ( for example when I connect a new HDD to windows which the owner of existed file is another user not exist on this computer. )
    – M-Razavi
    Commented Jul 29, 2015 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .