macOS User Management & Privilege Analysis
A skill for understanding and working with macOS user accounts, privilege levels, and external authentication systems.
User Account Types
System Daemon Accounts
System daemon accounts are reserved for background processes. They typically start with an underscore (_) prefix.
Common daemon accounts:
_amavisd, _analyticsd, _appinstalld, _appleevents, _applepay
_appowner, _appserver, _appstore, _ard, _assetcache
_astris, _atsserver, _avbdeviced, _calendar, _captiveagent
_ces, _clamav, _cmiodalassistants, _coreaudiod, _coremediaiod
_coreml, _ctkd, _cvmsroot, _cvs, _cyrus, _datadetectors
_demod, _devdocs, _devicemgr, _diskimagesiod, _displaypolicyd
_distnote, _dovecot, _dovenull, _dpaudio, _driverkit
_eppc, _findmydevice, _fpsd, _ftp, _fud, _gamecontrollerd
_geod, _hidd, _iconservices, _installassistant, _installcoordinationd
_installer, _jabber, _kadmin_admin, _kadmin_changepw, _knowledgegraphd
_krb_anonymous, _krb_changepw, _krb_kadmin, _krb_kerberos, _krb_krbtgt
_krbfast, _krbtgt, _launchservicesd, _lda, _locationd, _logd
_lp, _mailman, _mbsetupuser, _mcxalr, _mdnsresponder, _mobileasset
_mysql, _nearbyd, _netbios, _netstatistics, _networkd, _nsurlsessiond
_nsurlstoraged, _oahd, _ondemand, _postfix, _postgres, _qtss
_reportmemoryexception, _rmd, _sandbox, _screensaver, _scsd
_securityagent, _softwareupdate, _spotlight, _sshd, _svn
_taskgated, _teamsserver, _timed, _timezone, _tokend, _trustd
_trustevaluationagent, _unknown, _update_sharing, _usbmuxd, _uucp
_warmd, _webauthserver, _windowserver, _www, _wwwproxy, _xserverdocs
Why this matters: These accounts are not meant for interactive login. If you see unexpected activity from these accounts, investigate. They're also potential targets for privilege escalation if misconfigured.
Special Accounts
Guest Account
- Designed for temporary users with very strict permissions
- Check guest account status:
state=("automaticTime" "afpGuestAccess" "filesystem" "guestAccount" "smbGuestAccess")
for i in "${state[@]}"; do sysadminctl -"${i}" status; done
Nobody Account
- Used when processes need minimal permissions
- Often used for sandboxed operations
Root Account
- Has nearly unlimited permissions
- Important limitation: Even root cannot modify
/System due to System Integrity Protection (SIP)
- Root is the target of most privilege escalation attempts
User Privilege Levels
Standard User
The most basic user type with limited permissions.
Capabilities:
- Can use the system normally
- Can install software in their home directory
- Cannot install system-wide software
- Cannot modify system files
- Cannot add/remove users
Limitations:
- Needs admin approval for system changes
- Cannot access other users' files
- Cannot modify system configurations
Admin User
A standard user with elevated privileges through sudo access.
Capabilities:
- Operates as standard user by default
- Can perform root actions via
sudo
- Can install system-wide software
- Can modify system configurations
- Can manage other users
How it works:
- All users in the
admin group get sudo access via the sudoers file
- Located at
/etc/sudoers and files in /etc/sudoers.d/
- Admin users must authenticate with their own password for sudo
Check admin group membership:
groups $USER
grep admin /etc/group
Root User
The superuser with maximum privileges.
Capabilities:
- Can perform almost any action
- Can modify any file (except SIP-protected areas)
- Can change any user's password
- Can disable security features (if not SIP-protected)
Limitations:
- Cannot modify
/System directory (SIP protection)
- Some kernel protections still apply
External Account Authentication
macOS supports login via external identity providers (Facebook, Google, etc.).
Key Components
Main Daemon:
accountsd - Handles external account authentication
- Path:
/System/Library/Frameworks/Accounts.framework/Versions/A/Support/accountsd
Authentication Plugins:
- Location:
/System/Library/Accounts/Authentication/
- Contains plugins for different external providers
Account Type Configuration:
- Location:
/Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist
- Lists available account types for external authentication
Investigation Commands
# Check if accountsd is running
ps aux | grep accountsd
# List external authentication plugins
ls -la /System/Library/Accounts/Authentication/
# Check account type configuration
cat /Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist
# View accountsd process details
ps -o pid,ppid,user,command -C accountsd
Practical Use Cases
Enumerate All Users
# List all users from /etc/passwd
cat /etc/passwd | cut -f1 -d: | grep -v "^_"
# List all users with home directories
df -h /Users
ls -la /Users/
# Find users with login shells
cat /etc/passwd | grep -E "/bin/(ba)?sh"
Check User Privileges
# Check current user's groups
groups
# Check if user is in admin group
grep admin /etc/group
# Check sudo configuration
sudo -l
# View sudoers file (requires root)
sudo cat /etc/sudoers
Identify Potential Privilege Escalation Vectors
# Find world-writable files in user directories
find /Users -type f -perm -0002 2>/dev/null
# Check for SUID binaries
find / -perm -4000 -type f 2>/dev/null
# Look for sudo misconfigurations
sudo -l
# Check for passwordless sudo
sudo -n ls 2>/dev/null && echo "Passwordless sudo available"
External Account Analysis
# Check for external account plugins
ls -la /System/Library/Accounts/Authentication/
# View accountsd configuration
cat /Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist
# Check for cached external credentials
ls -la ~/Library/Accounts/
Security Considerations
When Investigating Users
- Check for unexpected daemon activity - If a daemon account is running interactive processes, investigate
- Review admin group membership - Unauthorized admin access is a common compromise indicator
- Audit sudo configurations - Misconfigured sudo can lead to privilege escalation
- Monitor external account usage - External accounts may have different security implications
Common Attack Vectors
- Sudo misconfiguration - Improper sudoers rules can grant root access
- Weak admin passwords - Admin accounts are high-value targets
- External account compromise - External providers may have weaker security
- Guest account abuse - Guest accounts may be misconfigured with excessive permissions
Defense Recommendations
- Minimize admin accounts - Only necessary users should have admin privileges
- Enable SIP - System Integrity Protection limits root capabilities
- Audit sudoers regularly - Review and clean up sudo configurations
- Monitor daemon accounts - Alert on unexpected activity from system accounts
- Secure external authentication - Use MFA for external account providers
Quick Reference
| Account Type |
Login Shell |
Home Directory |
Purpose |
Daemon (_) |
/usr/bin/false |
/var |
System processes |
| Guest |
/bin/bash |
/var/db/registration |
Temporary access |
| Standard |
/bin/zsh |
/Users/username |
Regular users |
| Admin |
/bin/zsh |
/Users/username |
Elevated privileges |
| Root |
/bin/zsh |
/var/root |
Superuser |
Next Steps
After understanding the user structure:
- Enumerate all users on the target system
- Identify admin accounts and their sudo privileges
- Check for external accounts that may provide alternative access
- Look for privilege escalation paths through misconfigurations
- Document findings for security assessment reports
1---2name: macos-user-management3description: How to enumerate, analyze, and understand macOS user accounts, privilege levels, and external authentication systems. Use this skill whenever the user mentions macOS users, user enumeration, privilege escalation, admin accounts, sudo access, external accounts, or any macOS security assessment involving user management. This includes penetration testing, security audits, system administration, or understanding macOS user privilege structures.4---56# macOS User Management & Privilege Analysis78A skill for understanding and working with macOS user accounts, privilege levels, and external authentication systems.910## User Account Types1112### System Daemon Accounts1314System daemon accounts are reserved for background processes. They typically start with an underscore (`_`) prefix.1516**Common daemon accounts:**17- `_amavisd`, `_analyticsd`, `_appinstalld`, `_appleevents`, `_applepay`18- `_appowner`, `_appserver`, `_appstore`, `_ard`, `_assetcache`19- `_astris`, `_atsserver`, `_avbdeviced`, `_calendar`, `_captiveagent`20- `_ces`, `_clamav`, `_cmiodalassistants`, `_coreaudiod`, `_coremediaiod`21- `_coreml`, `_ctkd`, `_cvmsroot`, `_cvs`, `_cyrus`, `_datadetectors`22- `_demod`, `_devdocs`, `_devicemgr`, `_diskimagesiod`, `_displaypolicyd`23- `_distnote`, `_dovecot`, `_dovenull`, `_dpaudio`, `_driverkit`24- `_eppc`, `_findmydevice`, `_fpsd`, `_ftp`, `_fud`, `_gamecontrollerd`25- `_geod`, `_hidd`, `_iconservices`, `_installassistant`, `_installcoordinationd`26- `_installer`, `_jabber`, `_kadmin_admin`, `_kadmin_changepw`, `_knowledgegraphd`27- `_krb_anonymous`, `_krb_changepw`, `_krb_kadmin`, `_krb_kerberos`, `_krb_krbtgt`28- `_krbfast`, `_krbtgt`, `_launchservicesd`, `_lda`, `_locationd`, `_logd`29- `_lp`, `_mailman`, `_mbsetupuser`, `_mcxalr`, `_mdnsresponder`, `_mobileasset`30- `_mysql`, `_nearbyd`, `_netbios`, `_netstatistics`, `_networkd`, `_nsurlsessiond`31- `_nsurlstoraged`, `_oahd`, `_ondemand`, `_postfix`, `_postgres`, `_qtss`32- `_reportmemoryexception`, `_rmd`, `_sandbox`, `_screensaver`, `_scsd`33- `_securityagent`, `_softwareupdate`, `_spotlight`, `_sshd`, `_svn`34- `_taskgated`, `_teamsserver`, `_timed`, `_timezone`, `_tokend`, `_trustd`35- `_trustevaluationagent`, `_unknown`, `_update_sharing`, `_usbmuxd`, `_uucp`36- `_warmd`, `_webauthserver`, `_windowserver`, `_www`, `_wwwproxy`, `_xserverdocs`3738**Why this matters:** These accounts are not meant for interactive login. If you see unexpected activity from these accounts, investigate. They're also potential targets for privilege escalation if misconfigured.3940### Special Accounts4142**Guest Account**43- Designed for temporary users with very strict permissions44- Check guest account status:4546```bash47state=("automaticTime" "afpGuestAccess" "filesystem" "guestAccount" "smbGuestAccess")48for i in "${state[@]}"; do sysadminctl -"${i}" status; done49```5051**Nobody Account**52- Used when processes need minimal permissions53- Often used for sandboxed operations5455**Root Account**56- Has nearly unlimited permissions57- **Important limitation:** Even root cannot modify `/System` due to System Integrity Protection (SIP)58- Root is the target of most privilege escalation attempts5960## User Privilege Levels6162### Standard User6364The most basic user type with limited permissions.6566**Capabilities:**67- Can use the system normally68- Can install software in their home directory69- Cannot install system-wide software70- Cannot modify system files71- Cannot add/remove users7273**Limitations:**74- Needs admin approval for system changes75- Cannot access other users' files76- Cannot modify system configurations7778### Admin User7980A standard user with elevated privileges through sudo access.8182**Capabilities:**83- Operates as standard user by default84- Can perform root actions via `sudo`85- Can install system-wide software86- Can modify system configurations87- Can manage other users8889**How it works:**90- All users in the `admin` group get sudo access via the sudoers file91- Located at `/etc/sudoers` and files in `/etc/sudoers.d/`92- Admin users must authenticate with their own password for sudo9394**Check admin group membership:**95```bash96groups $USER97grep admin /etc/group98```99100### Root User101102The superuser with maximum privileges.103104**Capabilities:**105- Can perform almost any action106- Can modify any file (except SIP-protected areas)107- Can change any user's password108- Can disable security features (if not SIP-protected)109110**Limitations:**111- Cannot modify `/System` directory (SIP protection)112- Some kernel protections still apply113114## External Account Authentication115116macOS supports login via external identity providers (Facebook, Google, etc.).117118### Key Components119120**Main Daemon:**121- `accountsd` - Handles external account authentication122- Path: `/System/Library/Frameworks/Accounts.framework/Versions/A/Support/accountsd`123124**Authentication Plugins:**125- Location: `/System/Library/Accounts/Authentication/`126- Contains plugins for different external providers127128**Account Type Configuration:**129- Location: `/Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist`130- Lists available account types for external authentication131132### Investigation Commands133134```bash135# Check if accountsd is running136ps aux | grep accountsd137138# List external authentication plugins139ls -la /System/Library/Accounts/Authentication/140141# Check account type configuration142cat /Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist143144# View accountsd process details145ps -o pid,ppid,user,command -C accountsd146```147148## Practical Use Cases149150### Enumerate All Users151152```bash153# List all users from /etc/passwd154cat /etc/passwd | cut -f1 -d: | grep -v "^_"155156# List all users with home directories157df -h /Users158ls -la /Users/159160# Find users with login shells161cat /etc/passwd | grep -E "/bin/(ba)?sh"162```163164### Check User Privileges165166```bash167# Check current user's groups168groups169170# Check if user is in admin group171grep admin /etc/group172173# Check sudo configuration174sudo -l175176# View sudoers file (requires root)177sudo cat /etc/sudoers178```179180### Identify Potential Privilege Escalation Vectors181182```bash183# Find world-writable files in user directories184find /Users -type f -perm -0002 2>/dev/null185186# Check for SUID binaries187find / -perm -4000 -type f 2>/dev/null188189# Look for sudo misconfigurations190sudo -l191192# Check for passwordless sudo193sudo -n ls 2>/dev/null && echo "Passwordless sudo available"194```195196### External Account Analysis197198```bash199# Check for external account plugins200ls -la /System/Library/Accounts/Authentication/201202# View accountsd configuration203cat /Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist204205# Check for cached external credentials206ls -la ~/Library/Accounts/207```208209## Security Considerations210211### When Investigating Users2122131. **Check for unexpected daemon activity** - If a daemon account is running interactive processes, investigate2142. **Review admin group membership** - Unauthorized admin access is a common compromise indicator2153. **Audit sudo configurations** - Misconfigured sudo can lead to privilege escalation2164. **Monitor external account usage** - External accounts may have different security implications217218### Common Attack Vectors2192201. **Sudo misconfiguration** - Improper sudoers rules can grant root access2212. **Weak admin passwords** - Admin accounts are high-value targets2223. **External account compromise** - External providers may have weaker security2234. **Guest account abuse** - Guest accounts may be misconfigured with excessive permissions224225### Defense Recommendations2262271. **Minimize admin accounts** - Only necessary users should have admin privileges2282. **Enable SIP** - System Integrity Protection limits root capabilities2293. **Audit sudoers regularly** - Review and clean up sudo configurations2304. **Monitor daemon accounts** - Alert on unexpected activity from system accounts2315. **Secure external authentication** - Use MFA for external account providers232233## Quick Reference234235| Account Type | Login Shell | Home Directory | Purpose |236|--------------|-------------|----------------|----------|237| Daemon (`_`) | `/usr/bin/false` | `/var` | System processes |238| Guest | `/bin/bash` | `/var/db/registration` | Temporary access |239| Standard | `/bin/zsh` | `/Users/username` | Regular users |240| Admin | `/bin/zsh` | `/Users/username` | Elevated privileges |241| Root | `/bin/zsh` | `/var/root` | Superuser |242243## Next Steps244245After understanding the user structure:2462471. **Enumerate all users** on the target system2482. **Identify admin accounts** and their sudo privileges2493. **Check for external accounts** that may provide alternative access2504. **Look for privilege escalation paths** through misconfigurations2515. **Document findings** for security assessment reports