← BACK TO HOME

The Shell Crossover, Part 6: Permissions, Ownership, and sudo on macOS

Map Windows permission and elevation habits to macOS ownership, POSIX modes, ACL inspection, sudo, root, admin users, and SIP boundaries.

Windows administrators bring useful instincts to permissions work: inspect before changing, know the execution context, and avoid broad inheritance mistakes. macOS uses a different permission model, so the commands and risk points change.

This article maps Windows permission habits to macOS ownership, POSIX modes, ACL inspection, sudo, and System Integrity Protection.

The short translation

Windows conceptmacOS conceptNotes
OwnerOwnerEvery file has an owning user.
Primary group or ACL groupsGroupEvery file has an owning group.
Users or Everyone permissionsOther mode bitsPOSIX permissions include owner, group, and other.
NTFS ACLsPOSIX modes plus optional ACLsmacOS can show ACLs with ls -le.
Run as administratorsudoElevates one command after authorization.
LocalSystemrootSimilar power level, not the same service model.
UAC promptsudo authenticationThe user must be allowed to use sudo.
Windows Resource ProtectionSIP and sealed system protectionsSome OS paths are protected even from root.

Reading POSIX permissions

Start in a safe lab path.

mkdir -p /tmp/admincrossover-permissions-lab
cd /tmp/admincrossover-permissions-lab
echo "sample" > sample.txt
ls -l sample.txt

Example output:

-rw-r--r--  1 jsmith  staff  7 May 31 12:00 sample.txt

Read it from left to right:

-          File type
rw-        Owner can read and write
r--        Group can read
r--        Other can read
jsmith     Owner
staff      Group

Directories use the execute bit differently than files. On a directory, execute means the user can traverse the directory.

mkdir example-dir
ls -ld example-dir

Using chmod safely

Change a file to owner read and write only.

chmod 600 sample.txt
ls -l sample.txt

Add execute for the owner.

chmod u+x sample.txt
ls -l sample.txt

Remove execute again.

chmod u-x sample.txt
ls -l sample.txt

PowerShell can call the same native commands.

$LabPath = "/tmp/admincrossover-permissions-lab"
New-Item -ItemType Directory -Path $LabPath -Force | Out-Null
Set-Location -Path $LabPath
Set-Content -Path "sample.txt" -Value "sample"
& /bin/ls -l "sample.txt"
& /bin/chmod 600 "sample.txt"
& /bin/ls -l "sample.txt"

Use symbolic modes while learning. chmod u+x file is easier to audit than a number if you are not fluent in octal notation.

Ownership and groups

Inspect owner and group with ls or stat.

ls -l sample.txt
stat -f "%Sp %Su %Sg %N" sample.txt

Change group to staff only in the lab path.

chgrp staff sample.txt
ls -l sample.txt

Changing owners generally requires elevation.

sudo chown root:wheel sample.txt
ls -l sample.txt
sudo chown "$USER":staff sample.txt

That example is safe because it stays inside /tmp/admincrossover-permissions-lab. Do not practice recursive ownership changes in /Applications, /Library, /System, or a user’s home folder.

Inspecting ACLs

POSIX mode bits are not the whole story. macOS can also apply ACLs. Use ls -le to inspect them.

ls -le sample.txt

PowerShell version:

& /bin/ls -le "sample.txt"

Do not assume that chmod 755 tells the whole effective-permission story. Check ACLs when behavior does not match the POSIX mode bits.

sudo is not a permanent state

sudo runs a command with elevated privileges after authorization.

sudo ls /var/db

It is closer to “run this command elevated” than “be an administrator forever.” The user must be allowed to use sudo, commonly through admin-group membership and the system sudoers configuration.

PowerShell does not turn into an elevated shell by itself on macOS. You still call native commands with sudo when elevation is needed.

& /usr/bin/sudo /bin/ls /var/db

When you script with sudo, remember that non-interactive management contexts may not have a user present to type a password. In MDM workflows, prefer a true management context rather than expecting an interactive sudo prompt.

root is powerful, but not unlimited

The root user is the Unix superuser, but modern macOS includes protections that limit changes to protected operating system locations. System Integrity Protection restricts modifications to protected files and folders, even when a process has root privileges.

This is a key difference from older administrator assumptions. If a path is protected by the platform, the right answer is not usually “try harder with sudo.” The right answer is to use the supported management mechanism or place your files in the correct admin-writable location.

You can check SIP state from the running OS.

csrutil status

On a standard managed Mac, expect to see that System Integrity Protection is enabled. SIP can only be modified from macOS Recovery. It cannot be disabled by a normal running process, even one using sudo.

Practical admin-created content normally belongs in places such as:

/Library/Application Support
/Library/Preferences
/Library/LaunchDaemons
/Library/LaunchAgents
/usr/local

There is an important nuance in that list. /usr is SIP-protected as a whole, but /usr/local is an explicit exception intended for third-party and administrator-managed tools. Put admin-installed command-line tools in /usr/local/bin, not /usr/bin or /usr/sbin.

Avoid using /System as an admin workspace.

The dangerous commands

These patterns are common in emergency troubleshooting and dangerous in production.

sudo chmod -R 777 /some/path
sudo chown -R root:wheel /some/path

The first grants broad write access. The second can break application ownership, user data access, package receipts, or management agent behavior. Recursive commands are not automatically wrong, but they require a narrowly scoped path and a tested rollback plan.

Safer pattern:

# Inspect first.
ls -leO@ /path/to/item
stat -f "%Sp %Su %Sg %N" /path/to/item

# Change one item or one controlled directory after confirming scope.
chmod u+rw /path/to/item

The ls -leO@ pattern is dense but useful: -e shows ACLs, -O shows BSD file flags, and -@ shows extended attributes. Extended attributes are metadata attached to a file outside the normal file content, and they can affect macOS behavior in ways a simple POSIX mode string will not reveal.

The operating rule

On macOS, permissions work starts with context: user, group, mode bits, ACLs, elevation, and platform protections.

Do not translate Windows administration as “take ownership and force permissions.” Translate the goal. Inspect first, change the smallest possible scope, use sudo only when needed, and respect SIP-protected operating system paths.