Disable guest account login
- 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.
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.
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
- 6.1.3 Disable guest account login. Tenable®. www.tenable.com. (2025).
Original: https://www.tenable.com/audits/items/CIS_Apple_macOS_11_v1.1.0_L1.audit:153219403c9d852b574cc5ef59902392
Archived: https://web.archive.org/web/20250123200241/https://www.tenable.com/audits/items/CIS_Apple_macOS_11_v1.1.0_L1.audit:153219403c9d852b574cc5ef59902392 - SecPod SCAP Repo, a repository of SCAP Content (CVE, CCE, CPE, CWE, OVAL and XCCDF). www.scaprepo.com. (2025).
Original: https://www.scaprepo.com/view.jsp
Archived: https://archive.ph/2025.01.12-201010/https://www.scaprepo.com/view.jsp?id=CCE-50057-9 - Script to enable Guest User on Mac. www.hexnode.com. (2024).
Original: https://www.hexnode.com/mobile-device-management/help/script-to-enable-guest-user-on-mac
Archived: https://web.archive.org/web/20241008165805/https://www.hexnode.com/mobile-device-management/help/script-to-enable-guest-user-on-mac/ - Guest user - Apple Support. support.apple.com. (2025).
Original: https://support.apple.com/guide/mac-help/aside/glos8c20ac45/15.0/mac/15.0
Archived: https://archive.ph/2025.01.12-195712/https://support.apple.com/guide/mac-help/aside/glos8c20ac45/15.0/mac/15.0 - The macOS system must enforce access restrictions.. www.stigviewer.com. (2024).
Original: https://www.stigviewer.com/stig/apple_macos_11_big_sur/2021-06-16/finding/V-230823
Archived: https://web.archive.org/web/20241125172444/https://www.stigviewer.com/stig/apple_macos_11_big_sur/2021-06-16/finding/V-230823 - Comment. Disable macOS Guest user account script. gist.github.com. (2025).
Original: https://gist.github.com/justinpawela/8a924f36f86bac2b563bf6832eefff25
Archived: https://archive.ph/2025.01.12-200100/https://gist.github.com/justinpawela/8a924f36f86bac2b563bf6832eefff25?permalink_comment_id=1893323%23gistcomment-1893323 - The macOS system must not have a guest account.. www.stigviewer.com. (2024).
Original: https://www.stigviewer.com/stig/apple_os_x_10.13/2018-10-01/finding/V-81615
Archived: https://web.archive.org/web/20241125065056/https://www.stigviewer.com/stig/apple_os_x_10.13/2018-10-01/finding/V-81615 - NIST Special Publication 800-179 (December 2016). nvlpubs.nist.gov. (2024).
Original: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-179.pdf
Archived: https://web.archive.org/web/20240928201604/https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-179.pdf - bg Man Page - macOS - SS64.com. ss64.com. (2024).
Original: https://ss64.com/mac/sysadminctl.html
Archived: https://web.archive.org/web/20241125024856/https://ss64.com/mac/sysadminctl.html - macos - Hidden accounts on OSX - Stack Overflow. stackoverflow.com. (2020).
Original: https://stackoverflow.com/questions/17543231/hidden-accounts-on-osx
Archived: https://web.archive.org/web/20200418000246/https://stackoverflow.com/questions/17543231/hidden-accounts-on-osx#answer-17552759 - atomic-red-team/atomics/T1564.002/T1564.002.md at master · privacysexy-forks/atomic-red-team · GitHub. github.com. (2025).
Original: https://github.com/privacysexy-forks/atomic-red-team/blob/master/atomics/T1564.002/T1564.002.md
Archived: https://archive.ph/2025.01.12-204235/https://github.com/privacysexy-forks/atomic-red-team/blob/master/atomics/T1564.002/T1564.002.md
Apply Now
Choose one of three ways to apply:
Help
How to apply or restore "Disable guest account login" using script
- ≈ 3 min to complete
- Tools: Web Browser
- Difficulty: Medium
- ≈ 5 instructions
- 1
Download
Download the script file by clicking on thebutton above.
Use button above to restore changes. - 2
Keep the file
If warned by your browser, keep the file. - 3
Open
Open the downloaded file. - 4
Exit
Once it's done, press any key to exit the window. - 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
Help
How to apply or restore "Disable guest account login" using privacy.sexy
- ≈ 3 min to complete
- Tools: privacy.sexy
- Difficulty: Simple
- ≈ 4 instructions
- 2
Choose script
- Search for the script name: Disable guest account login
- Check the script by clicking on the checkbox.
- 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.
- Apply
- Revert
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
InN1ZG8gZGVmYXVsdHMgZGVsZXRlICcvTGlicmFyeS9QcmVmZXJlbmNlcy9jb20uYXBwbGUubG9naW53aW5kb3cnICdHdWVzdEVuYWJsZWQnIg==
Help
How to apply or restore "Disable guest account login" using commands
- ≈ 2 min to complete
- Tools: Terminal app
- Difficulty: undefined
- ≈ 3 instructions
- 1
Open terminal
Open Terminal app. - 2
Copy code
Copy the code: - 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.
- Disable guest accounts
- Security improvements
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...
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:
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.