The kind of tenancy laws I read in articles like these, sound absolutely idiotic. If you let someone into your home, and they aren't on the lease, you should be able to kick them out anytime they overstay their welcome. If you do sign a lease with someone, and they haven't paid their rent, you should be able to throw their stuff out and change the locks as soon as their security deposit has run itself out. As a forme…
SF has pretty lenient tenancy laws but even then, if someone stops paying rent, you can evict them.
If you are both leasing from the landlord you have equal rights and actually only the landlord can evict.
If you are the master leaseholder and your roommate is subleasing then you have many of the obligations of a landlord.. which means you actually have a lot of regulations to comply with that will probably trip you up if your lessee is both malicious and litigous. Especially if the sublease was established without a contract.
Usually you can get away with it bcause the kinds of people who just stop paying rent are deadbeats and won't challenge.