It's illegal in SF even if you own your own place:
San Francisco bans all residential rentals of less than 30 days unless the hosts have a conditional use permit - an expensive and cumbersome process that virtually everyone ignores. The ban applies whether the hosts own or rent, paying guests visit frequently or once a year, or hosts rent out a room or an entire dwelling.
... though I'm not sure what the penalty is in that case, as you're not going to get evicted from your own home.