Disable root account login to prevent unauthorized direct access on macOS endpoints
This Automox Worklet™ disables root account login at the macOS login window. The Worklet removes the root user's ability to authenticate directly through the login prompt, forcing administrators and users to log in with standard user accounts instead.
The Worklet accomplishes this by modifying the root account's authentication authority and setting the user shell to /usr/bin/false. This prevents interactive root login while preserving the root account's ability to run system processes and scripts.
Disabling root login is a fundamental macOS security best practice. The root account has unrestricted access to all system files, settings, and processes. Allowing direct root authentication creates a significant security risk, as attackers who obtain root credentials can bypass all security controls and completely compromise the endpoint.
By disabling root login at the login window, you limit attack surface and enforce the principle of least privilege. Users must log in with their standard accounts and use sudo when elevated access is necessary, creating an audit trail of privilege escalation requests.
This configuration aligns with security frameworks including CIS Benchmarks and NIST 800-53 recommendations for macOS endpoint hardening.
Evaluation phase: Checks whether the root user's AuthenticationAuthority is configured. The Worklet queries the directory services using the dscl command to examine /Users/root AuthenticationAuthority. If this value is empty, root login is already disabled and no remediation is needed.
Remediation phase: Removes the root account's authentication capabilities by deleting the AuthenticationAuthority attribute, setting the password field to an asterisk (disabling password authentication), and setting the user shell to /usr/bin/false (preventing interactive shells). These changes prevent the root account from being used at the login window.
macOS 10.6 or later
FixNow compatibility: RunNow feature support for immediate execution
No prerequisites or additional configuration required
After running this Worklet, the root account will no longer be accessible from the macOS login window. You can verify this by attempting to SSH as root, which should be denied, or by checking /etc/ssh/sshd_config for 'PermitRootLogin no'. Attempts to log in as root will fail, forcing users and administrators to authenticate with standard user accounts. Users requiring elevated privileges must use the sudo command from their standard account, which creates an audit trail of privilege escalation.
To verify remediation, you can attempt to log in as root at the login window (authentication will fail) or query the root account's properties using the dscl command: dscl . -read /Users/root AuthenticationAuthority. This command should return an error if root login is properly disabled.
Run this Worklet on a pilot macOS endpoint and review evaluation output for disable root account login.
Confirm Automox activity logs show successful completion and exit code 0.
Verify endpoint state using checks aligned to evaluation script logic, such as else, exit.
Validate remediation effects from script operations such as else, dscl, exit, then rerun evaluation for compliance.
For technical validation, compare endpoint state to the Worklet evaluation logic and remediation flow for disable root account login. This supports repeatable security workflows, faster change control review, and auditable compliance evidence.
Useful script references for this Worklet include evaluation operations such as else, exit and remediation operations such as else, dscl, exit. Use these indicators to verify that endpoint changes match intended policy outcomes.


By submitting this form you agree to our Master Services Agreement and Privacy Policy.
Already have an account? Log in
Consider Worklets your easy button
A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

AUTOMOX + WORKLETS™
Uncover new possibilities with simple, powerful automation.
By submitting this form you agree to our Master Services Agreement and Privacy Policy