DevNull Notes
  • README
  • windows-privilege-escalation
    • Basic Windows Commands
    • Managing Files and Folder Permissions
    • Understanding the ACL Entries
    • Booting Files
    • User Management Commands
    • Network Enumeration
Powered by GitBook
On this page
  • Taking Ownership of a file using TAKEOWN
  • Modifying File Permissions with CACLS command
  • Managing File and Folder Permissions in Windows with ICACLS Commands
  1. windows-privilege-escalation

Managing Files and Folder Permissions

Taking Ownership of a file using TAKEOWN

The TAKEOWN command in windows allos a administrator to take ownership of files and folder, especially when access is denied due to permission issues

  • Displays help information fo the TAKEOWN command

takeown /?
  • Takes Ownership of a specified file

takeown /F <filename>
  • Takes ownership of all files recursively in a folder

takedown /F <foldername> /R /D Y
  • Take ownership of all files in drivee

takedown /F E:\* /R /D y

Modifying File Permissions with CACLS command

The CACLS command is used to view and modify file access control lists (ACLs) in windows. However, CACLS is depricated and replaced by ICACLS in modern windows versions

  • Displays the information of CACLS commans

cacls /?
  • Shows the current permissions of the specified file.

cacls <filename>
cacls iisstart.htm
  • Grants specific user the specific permissions.

cacls <filename> /G <username>:<permission>
cacls iisstart.htm /G DevNull:F
takeown /F iisstart.htm
cacls iisstart.htm /G Administrator:F
  • F - Full Control

  • C - Change (Modify)

  • R - Read

  • W - Write

Managing File and Folder Permissions in Windows with ICACLS Commands

ICACLS is the modern command-line tool in windows for managing file and folder permissions. It replaces CACLS and provides more granular control over Access COntroll Lists(ACLs)

  • Basic Syntax, viewing permissions

    ICACLS <File_or_Folder> [Options]
  • Displays the Current ACLs

ICACLS iisstart.htm
  • Modifying Permissions, Grant Permissions, Grant Full Control(F)

icacls iisstart.htm /grant DevNull:F
  • Grants Full Control (F) and Modify (M) permissions

icacls iisstart.html /grant DevNull:(F,M)
  • Grant Read (R) access to everyone

icacls iisstart.htm /grant Everyone:R
  • Remove Permission, Removes Eceryone from the ACL lists.

icacls iisstart.htm /remove Everyone
  • Modifying Inheritance, Disables inheritance for the file

icacls iisstart.htm /inheritance:d
  • Enables inheritance for the files

icacls iisstart.htm /inheritance:e
  • Set Ownership

icacls iisstart.htm /setowner Administrator
  • Backup and Restore ACL

icacls iisstart.htm /save backup_acl.txt

restore backup_acl.txt

icacls iisstart /restore backup_acl.txt
PreviousBasic Windows CommandsNextUnderstanding the ACL Entries

Last updated 1 month ago