Is there any way to "Allow Guest Account to log in to this computer" via the command line?

8,269

The option "Allow guests to log in to this computer" is stored as "GuestEnabled" key in /Library/Preferences/com.apple.loginwindow.plist

You can change it by using defaults command with root permission, tested on MountainLion 10.8.4

Read

sudo defaults read /Library/Preferences/com.apple.loginwindow GuestEnabled
#1 -> Enabled, 0 -> Disabled

Write

sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool YES|NO
Share:
8,269
Shelby V
Author by

Shelby V

Updated on September 18, 2022

Comments

  • Shelby V
    Shelby V over 1 year

    How to enable “Allow Guests to log in to this computer” option on Mac OS X 10.8 (Mountain Lion) via command line?

    • slhck
      slhck about 11 years
      There are quite a few things going on in the background when you tick the box. Not easy two wrap this all up in one or two lines of code. Is there a specific reason you need to do this via command line?
  • Tim Dearborn
    Tim Dearborn over 5 years
    This does not work on 10.14.x for devices that have never had the Guest account previously enabled. I posted a question in regards to this and 10.14 on Ask Different at apple.stackexchange.com/questions/346088/…