Permissions and Ownership in Windows

shunmare

shun

Posted on August 12, 2023

Permissions and Ownership in Windows

In Windows, files and directories have a set of permissions that can be assigned to individual users or groups. These permissions include Read, Write, Execute, and many others.

  • Read (R): Allows reading the file's contents.
  • Write (W): Permits modifying the file's contents.
  • Execute (X): Enables executing the file as a program.

Changing File Permissions with icacls

You can use the icacls command to modify access permissions for files and directories.

C:\> icacls file.txt /grant John:R  # Grant read permission to John
C:\> icacls file.txt /deny John:W   # Deny write permission to John
Enter fullscreen mode Exit fullscreen mode

Changing File Owner with takeown

The takeown command lets you change the owner of files and directories.

C:\> takeown /F file.txt /A  # Change the file's owner to the Administrators group
Enter fullscreen mode Exit fullscreen mode

Viewing File Permissions with icacls

The icacls command displays file and directory access permissions, owner, and other details.

C:\> icacls file.txt
file.txt NT AUTHORITY\SYSTEM:(I)(F)
         BUILTIN\Administrators:(I)(F)
         BUILTIN\Users:(I)(RX)
Enter fullscreen mode Exit fullscreen mode

Understanding and managing permissions and ownership is crucial for maintaining security and proper access control in a Windows system.

💖 💪 🙅 🚩
shunmare
shun

Posted on August 12, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related