Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment

Fast User Switching

Fast User Switching, when enabled, allows users to leave one session open and hop to another user account. Great for training, testing and impressing friends (ok, so maybe it won’t impress your friends, but the thumb trick is getting old). To enable Fast User Switching, open the Accounts System Preference pane and click on Login Options. Then check the box for Show fast user switching menu. By default you’ll then see your user name in the menu bar.

To do this from the command line:

defaults write /Library/Preferences/.GlobalPreferences MultipleSessionEnabled -bool 'YES'

To then disable it from the command line:

defaults write /Library/Preferences/.GlobalPreferences MultipleSessionEnabled -bool 'NO'

What’s really cool though, is once enabled, you can switch users with a script as well, using the command line options available with CGSession, located in the user.menu item at /System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession.

/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession -switchToUserID 501

Or to simply go to a login screen:

/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession -suspend