Files and folders

Change who owns a file or folder

Fix "permission denied" on a file that belongs to another user by giving it to the right one.

Fill these in once
  1. See who owns it now
    Terminal
    ls -l ./project

    The third column is the owner.

  2. Change the ownerNeeds sudo
    Terminal
    sudo chown alex ./project
  3. Change a folder and everything inside itNeeds sudo
    Terminal
    sudo chown -R alex ./project

Check it worked

  1. Check the new owner
    Terminal
    ls -l ./project
  1. See who owns it now
    Terminal · Ubuntu / Debian
    ls -l ./project

    The third column is the owner.

  2. Change the ownerNeeds sudo
    Terminal · Ubuntu / Debian
    sudo chown alex ./project
  3. Change a folder and everything inside itNeeds sudo
    Terminal · Ubuntu / Debian
    sudo chown -R alex ./project

Check it worked

  1. Check the new owner
    Terminal · Ubuntu / Debian
    ls -l ./project
  1. See who owns it now
    PowerShell
    (Get-Acl ./project).Owner
  2. Change the ownerRun as administrator
    PowerShell
    icacls ./project /setowner alex
  3. Change a folder and everything inside itRun as administrator
    PowerShell
    icacls ./project /setowner alex /T

Check it worked

  1. Check the new owner
    PowerShell
    (Get-Acl ./project).Owner