Since I have answered a previous questions of yours and I discovered that you are from the state of California.
As you are aware that I am not a lawyer, nothing in this document should be considered legal or professional advice in any jurisdiction. Because every situation and circumstance is unique, Landlord and Tenant Laws varies by state/country, the answer to YOUR question may require a different answer o...
Since I have answered a previous questions of yours and I discovered that you are from the state of California.
As you are aware that I am not a lawyer, nothing in this document should be considered legal or professional advice in any jurisdiction. Because every situation and circumstance is unique, Landlord and Tenant Laws varies by state/country, the answer to YOUR question may require a different answer or explanation than what is given here. You should always check the laws and consult a paid professional who specializes in this field of expertise.
Here's a website that I find may be useful to you. I have extracted some excerpts from this site.
California Tenant Law
Get out of Victim Mode
Chances are, you're panicked at the moment because the landlord has started evicting you. You feel like a victim. If you feel intimidated or threatened by the process, you're normal. You don't know what to expect, and the landlord acts like he's holding all the cards. You've heard rumors about how it goes. It's like walking in the dark, and things are hitting you in head. We're going to turn on the floodlights, give you a map, show you where the safe spots are and how to avoid the danger zones, and get you where you want to be.
You can't have fun doing this if you're intimidated. The goal here is to replace your fear and anxiety with knowledge, a strategy, a clear plan, and enjoyment of the game you've just been invited to play. Yes, it's a game, and one that you can win in real terms. The downside is real, certainly, but not the end of the world. Usually, your worst case scenario is that you have to move to another location, and continue with life there. Yes, having to move is such a hassle, sometimes an expensive one. Nobody likes moving. However, it's not something you couldn't have chosen to do, in your own sweet time. And there we are: you might want to move, but just not yet. Most clients have lots of fun doing this, driving the landlord crazy.
The Eviction Process
Eviction is the means by which a landlord can legally get you to move out. If you win, you stay put. If you did nothing to stop it, you would lose but have about a month from the filing of the eviction lawsuit before you would be locked out by the Sheriff. If you fight it, getting 2-3 months more time [even if you lose] is easy. My record is 14 months, and it could have been longer. That landlord gave up over $10,000 in back rent just to have the tenant leave, so we settled for that.
As shown in the diagram below, eviction usually starts with a notice, then goes to a lawsuit called an "unlawful detainer", or "UD" for short. If you win, you stay in possession and the landlord has to reimburse you for your legal costs. If you lose, the Sheriff has to give you a 5-day notice before a lockout, and finally you leave. You can go back and get your stuff after being locked out. While you're in this process, you pay no rent; you still owe it, but it stays in your pocket. You can use that money to pay for legal expenses to fight the eviction [thanks, Mr. Landlord!] and to pay for moving, if you choose to do that.
Landlords try to scare you into moving, and not fighting it, because they know how much hassle you can give them, and how expensive it can be to get you out. Here are the common myths:
(1) The landlord CANNOT lock you out, remove your property, remove doors or windows, or turn off utilities to get you out, in lieu of court; Civil Code 789.3 prohibits that [for residential tenants] and makes the landlord liable to you for actual costs plus $100 per day that it continues, and the police will back you on this one [Penal Code 484].
(2) The landlord CANNOT have the police or Sheriff arrest you for overstaying your welcome, instead of going to court. The Sheriff may be used to serve the eviction papers, but anything beyond that awaits the court's determination, first.
(3) The landlord CANNOT barge in and start doing major construction to make it impossible to live there, or otherwise interfere with your quiet enjoyment to force you out; Civil Code 1940.2 prohibits that, and makes the landlord liable for $2000 for each such attempt, in addition to your actual losses. The police will back you on this one, too [Penal Code 484].
(4) The landlord CANNOT threaten to report you to immigration authorities or other law enforcement, nor make any other threat to get you out. Civil Code 1940.2 prohibits that, and makes the landlord liable for $2000 for each such attempt, in addition to your actual losses. The police will back you on this one, as well [Penal Code 518].
Foreclosures
If you are a homeowner or the tenant of a property owner who is facing foreclosure, or has lost the property through foreclosure, there are thousands like you through California faced with the same dilemma. Under the law, you are entitled to no special treatment because you used to be the owner, now because you had a lease with the owner. You are basically treated the same as any apartment tenant being evicted for no reason.
The bank does not have to talk to you, work with you, consider your family or children's education, or even try to sell the property to you. Junk yard dogs seem to have more manners and common sense than the people you will probably meet to tell you to get out. You can't pay them for more time, or even expect courtesy when they want to show the property to new buyers or realtors while you're still living there. Out! Out! Out! is what you get, in most instances.
Occasionally, a bank will offer "cash for keys," where they tend you some money to move out without a fuss. Sounds good up front, but what if you move and they don't pay you? Even agreements looking like they promise payment can be invalidated by having you sign, but they don't, or by having someone sign who doesn't have authority, or can't be found later, or not giving you a copy. The real zinger for tenants of the former landlord is that you sign off your rights in exchange for the money. What rights? You have the right to get your full security deposit back from the bank, because it is the new owner and the current owner owes you your deposit, even if they never got it from the old owner. [The exception is where the former landlord pays you the full deposit beforehand.] The "cash" that you're getting is almost always less than the full deposit, so that when you sign the agreement, you give up the bird in your hand for two in the bush. The bank has the obligation to pay you the full deposit, not just a part, so your "cash for keys" agreement has you giving up the rest of your deposit, and then you have to find your former landlord, who may very well have filed bankruptcy. All that glitters is not gold.
Another quirk in the legal system is where a desperate property owner is met by the vultures who have seen the recorded Notice of Default indicating a pending foreclosure. They prey upon the desperate and often use "we can help" devices like an "equity purchase" where they "buy" your interest in the property under the guise that they will cover your mortgage payments for a while until you can financially recover, and you pay them "rent." As you can expect, they don't pay the mortgage, but just collect your "rent," and let the property continue through foreclosure. If you are one of those, you have the right to sue them but the bank's foreclosure will probably continue.
Taking Action
Now that you have an idea of what is in store, you need to decide how you want to approach this. You have three options available, depending on your budget, need for time, and the complexity of your case.