Password protect MacBook while keeping iTunes running
To keep any application active but to lock the machine you can try the following steps.


Launch the “Keychain Access” application located in
/Applications/Utilities.
Choose “Show Status in Menu Bar” from the View menu.
Now you have a lock in the menu bar. Use this menu to:
Click on the "lock icon" in your menu bar
Select "Lock Screen"


This activates Screen Effects which requires your password to unlock screen, but does not stop what is currently active on the OS




  Another way to keep any application active but to lock the machine you
  can try the following steps.



Open System Preferences

a. Select the Preference Pane "Security"

b. Choose the "General" tab

c. Check "Require password"

d. On 10.6 &amp; 10.7 you can also set the time in which you would like
to wait prior to initiating the lock (in this case you may want to
choose "immediately")
Select "Show All" Preference Panes
Select the Preference Pane "Desktop &amp; Screen Saver"

a. Set the "Start screen saver" at its minimum (3 min)


After 3 min of no use your machine will start the screen saver and when the screen saver is stopped you will be prompted to type your Username and Password. 


  HOWEVER: (Though I like JW8 slick use of Hot Corners you do not need to set them up nor do you need to wait 3 minutes for the
  Screen Saver to begin, you can simply use the following
  key-combo


Crtl-Shift-Eject





  You could also try the following commands if you have ambitions to
  create a short script.
  
  NOTE: If a script sounds like something you would like to create you will need to ensure root privileges.


For 10.6 &amp; 10.7 use the following command to make the security immediately follow the Screen Saver's launch:

defaults write com.apple.screensaver askForPasswordDelay 0


For 10.5, 10.6, &amp; 10.7 use the following command to turn on Security Preferences for your Screen Saver:

osascript -e 'tell application "System Events" to set require password to wake of security preferences to true'


To force the screen to lock 

open "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app"



  NOTE: You may notice that regardless of how the screen is locked you may be immediately be prompted for your Username &amp; Password as
  the running app is attempting to stop the Screen Saver/Lock.
  However, your application (iTunes in this case) will continue to run
  even while your screen is locked. :–)