Cohabitation

When an unmarried couple breaks up, is it legal for one partner to lock the other out of a home, and what are the legal rights of the partner who is locked out?