acl

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package acl grants and revokes NTFS permissions on a file or directory — a modern, icacls-backed take on the classic "shell out to cacls to fix a folder's rights" admin chore, which legacy scripts ran through an elevated helper.

Here the elevation story is separate: run the process elevated (or hand the command to runas) and call Grant/Revoke directly. The command assembly is pure and unit-tested; the execution is Windows-only.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedPlatform = errors.New("winadmin/acl: only supported on Windows")

ErrUnsupportedPlatform is returned off Windows.

Functions

func Grant

func Grant(path, principal string, perm Permission, opts Options) error

Grant gives principal (e.g. "CORP\\Tellers" or "Users") the permission on path.

func Revoke

func Revoke(path, principal string, opts Options) error

Revoke removes all granted ACEs for principal on path (icacls /remove).

Types

type Options

type Options struct {
	// Recurse applies the change to the directory and everything under it
	// (icacls /T).
	Recurse bool

	// NoInherit grants the right WITHOUT the (OI)(CI) object/container inherit
	// flags. The default (false) makes a directory grant inheritable, which is
	// what "give this group access to this folder" almost always means.
	NoInherit bool
}

Options tunes how the change is applied.

type Permission

type Permission string

Permission is an icacls simple-rights token.

const (
	Read        Permission = "R"  // read
	ReadExecute Permission = "RX" // read & execute
	Modify      Permission = "M"  // modify (read/write/delete)
	Write       Permission = "W"  // write
	FullControl Permission = "F"  // full control
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL