Remote control mac using ARD or teamviewer with password lock? I'm going to leave my main iMac in the office for a few days but I also need to access it remotely. 

Currently I noticed I can only remotely access the mac with ARD or teamviewer if the iMac account wasn't locked. 

How can I access the iMac remotely whilst still guaranteeing security to prevent unauthorized access from other sources. 

TeamViewer requires password to connect, so that's safe, but requires the iMac up and running and not locked.
This isn't actually true. With ARD/Screen Sharing, you can leave the mac logged-out, authenticate when you connect with ARD, and then log in to your user account after connecting.

You just need to make sure the Mac isn't set to go to sleep when no one is logged in.

With TeamViewer, you would need to have the account logged in, but it should still be accessible if you have the account locked or using fast user switching. Those features allow an account to stay logged in, but prevent it from being used (physically or remotely) until authentication.