In Mac OS X it’s pretty easy to switch users with the Fast User Switching icon in the menubar. However, if you wish to do it via the Dock or via a keystroke, you need to create a small AppleScript. This comes in handy for me when I want to log into the GUI as root. Since the root account will not show up under the menubar icon, you can use this to attain easy access to it. See this Apple Support article to learn how to enable the root account. Warning! Don’t use the root account if you don’t understand it!
First, open Universal Access control panel in System Preferences and check “Enable access for assistive devices”.
Next, download the AppleScript User Switcher.
Open the script in the Script Editor and modify the password and username to suit your needs.
Save and you’re done!
The original script and process was found at Mac OS X Hints. I’ve modified it slightly above.