How can I be auto logged in with the computer locked?
I outlined how to do this at https://www.engadget.com/2011-03-07-terminally-geeky-use-automatic-login-more-securely.html but I will summarize it for you:

set your account to autologin
create a login item (using launchd) which calls:


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

NOTE: that command should be ONE LONG LINE not two lines with a line break/line feed.
A more thorough explanation is available at TUAW, so I won't repeat it all here, because those are the relevant details.
What it does:
The idea is very simple, your account is set to auto-login, so all of your login items will run, however, one of those login items (the CGSession command listed above) will tell the loginwindow to appear. If you have used Fast User Switching before, you will be familiar with how it works.
&quot;But what if someone holds down the shift key to stop autolaunching?&quot;
In my testing, that will also prevent the user from being automatically logged in.
Is this 100% as safe as not using auto-login?
Probably not, but I'd consider it close to 99.999% as safe.
That said, use at your own risk, etc.