Skip to main content

Disable guest account login

Apply Now
Works with any MacWorks with any Mac running macOS/OS X on Intel or Apple Silicon.
  • Single actionThis page belongs to a script, containing basic changes to achieve a task.
  • macOS onlyThis script improves your privacy on macOS
  • Impact: MediumSystem Functionality Loss Risk: Moderate
    This action improves privacy with minimal impact when you run the recommended script.
    This action improves privacy with some impact when you run the recommended script.
  • Bash (Shell script)These changes use macOS system commands to update your settings.
  • Fully reversible

    You can fully restore this action (revert back to the original behavior) using this website.

    The restore/revert methods provided here can help you fix issues.

Overview

This script disables the macOS guest account login to enhance system security by blocking unauthorized access.

A guest account lets anyone use your Mac temporarily without a password or account 1. By default, macOS disables guest login but allows limited guest access to sharing services 1 2. When enabled, guest users:

  • Do not need a password to log in 1 2 3 4
  • Cannot modify system or user settings 3 4
  • Cannot access encrypted disks if FileVault is enabled 3 4
  • Have their files and activities automatically deleted upon logout 1 3 4

Although guest users cannot modify system settings or remotely access the system 1, the limited restrictions on guest access can still pose security risks 1 2 5. Attackers can use guest access to collect system information and potentially gain higher-level system privileges 1 2.

This script disables the guest account feature on macOS 5. It prevents anyone from accessing the system without a password 1 2 3 4 6. By restricting guest access, it reduces the chance of basic reconnaissance and potential privilege escalation 1 2 5 7.

The following security organizations recommend disabling guest access 1 5 7 8:

  • Center for Internet Security (CIS) 1: A non-profit organization that develops globally recognized security benchmarks and best practices
  • National Institute of Standards and Technology (NIST) 8: A U.S. government agency that develops cybersecurity standards and guidelines
  • Defense Information Systems Agency (DISA) 5 7: A U.S. Department of Defense combat support agency that provides cybersecurity guidance for military systems

Disabling guest login blocks unauthenticated users from accessing the system and strengthens security controls 7.

However, there are specific use cases where guest access may be beneficial:

  • Providing temporary access on shared devices 3
  • Allowing internet access 4 while preventing access to private data 3
  • Enabling the Find My app feature 4, which helps locate lost devices when someone uses Safari as a guest 3 4

In some situations, having a guest account may be useful for temporary access, public kiosks, or assisting with Find My, which relies on guest network usage if your device is lost 3 4. If you need those functions, consider keeping guest login enabled.

For multi-user or kiosk scenarios (like libraries, schools, or reception computers), you may want to carefully configure a limited account instead of relying on the guest session. This approach helps maintain necessary restrictions while still permitting safe usage by multiple people.

Caution

Disabling guest access prevents temporary users from accessing your Mac without a user account. This may impact Find My app and other temporary-access scenarios.

Technical Details

The script:

  • Modifies /Library/Preferences/com.apple.loginwindow!GuestEnabled 1 2 3 6 8.
  • Executes the sysadminctl command with -guestAccount off. sysadminctl is a tool used to administer system user accounts 9. -guestAccount Off option disables the guest account 9.

This script does not modify /Library/Preferences/com.apple.loginwindow!Hide500Users because this setting would affect both guest accounts and other system accounts 10 11.

Note: After running this script, the Users & Groups section in System Preferences may not correctly display the guest account status on older macOS versions 6.

Use with Caution

This script is only recommended if you understand its implications.

Some non-critical or features may no longer function correctly after running this script.

This script can be fully reversed to restore changes if something goes wrong.

Sources
PrivacyLearn.com maintains strict sourcing standards for accuracy, integrity and up-to-date content. Our content relies on authoritative sources including vendor documentation, industry standards, and verified research. Learn more about our verification process and quality standards in our editorial standards page.

Apply Now

Choose one of three ways to apply:

Download script

Download and run the script directly
  • No app needed
  • Offline usage
  • Free
  • Open-source
Help

How to apply or restore "Disable guest account login" using script

  • ≈ 3 min to complete
  • Tools: Web Browser
  • Difficulty: Medium
  • ≈ 5 instructions
  1. 1

    Download

    Download the script file by clicking on the   Apply protection  button above.
    Use   Undo protection button above to restore changes.
  2. 2

    Keep the file

    If warned by your browser, keep the file.
  3. 3

    Open

    Open the downloaded file.
  4. 4

    Exit

    Once it's done, press any key to exit the window.
  5. 5

    Restart

    Restart your computer for all changes to take effect.

Apply with privacy.sexy

Guided, automated application with safety checks
  • Recommended for most users
  • Includes safety checks
  • Free
  • Open-source
  • Popular
  • Offline/Online usage
Open privacy.sexy
Help

How to apply or restore "Disable guest account login" using privacy.sexy

  • ≈ 3 min to complete
  • Tools: privacy.sexy
  • Difficulty: Simple
  • ≈ 4 instructions
privacy.sexy is free and open-source application that lets securely apply this action easily with more advanced options.
  1. 1

    Open or download

    Open or download the desktop application
  2. 2

    Choose script

    1. Search for the script name: Disable guest account login
    2. Check the script by clicking on the checkbox.
  3. 3

    Run

    Click on ▶️ Run button at the bottom of the page.

    This button only appears on desktop version (recommended). On browser, use 💾 Save button.

Run commands

Copy and run commands manually Requires technical knowledge
Apply changes
sudo defaults write '/Library/Preferences/com.apple.loginwindow' 'GuestEnabled' -bool NO
if ! command -v 'sysadminctl' &> /dev/null; then
echo 'Skipping because "sysadminctl" is not found.'
else
sudo sysadminctl -guestAccount off
fi
Help

How to apply or restore "Disable guest account login" using commands

  • ≈ 2 min to complete
  • Tools: Terminal app
  • Difficulty: undefined
  • ≈ 3 instructions
  1. 1

    Open terminal

    Open Terminal app.
  2. 2

    Copy code

  3. 3

    Paste & run

    Paste the code into Terminal and press Enter to run.

    Some changes require a system restart to take effect

Similar Guides

Wider Goal

Guides below includes this guide to achieve a wider goal.See other more general settings that includes this one as one of its actions.
These plans combine multiple privacy settings, including this one, for stronger protection.
These scripts control guest access on macOS to protect your system's security and privacy. Guest access lets anyone use your Mac without a password or ac...

Disable guest accounts

Same Goal

Other guides in Disable guest accounts See settings that are in the same category as this guide.
Using other actions in the same category may help you achieve your goal better.

About the Creators

These people have authored this documentation and written its scripts:

  • Avatar of undergroundwires. The creator of PrivacyLearn and privacy.sexy. Black and white portrait showing a person wearing a polka dot tie and suit jacket, reflecting the professional expertise behind the privacy protection tools.
    • Certified security professional
    • 7+ years experience securing banks
    • Open-source developer since 2005
    • EU advisor, Public Speaker, Moderator
    • Hundreds across the globe
    • Testers, reviewers, developers
    • Companies, military agencies
    • Community since 2017

Reviewed By

This guide has undergone comprehensive auditing and peer review:
  • Expert review by undergroundwires

    • Verified technical accuracy and editorial standards
    • Assessed system impact and user privacy risks
    • Audited and verified using automated security tests
  • Public review by large community

    • Privacy enthusiasts and professionals peer-reviewed
    • Millions of end-users tested across different environments
    • Audited and verified using third-party security software

History

We continually monitor our guides, their impact and other potential privacy options. We update our guides when new information becomes available. On every update, we publicly store who made the change, what has been changed, why the change was made and when the change was made.