All states allow landlords to collect a security deposit when the tenant moves in. Half the states limit the amount landlords can charge, usually not more than a month or two worth of rent -- the exact amount depends on the state. (For the maximum amount in your state, see Chart: Security Deposit Limits, State by State.) Many states require landlords to put deposits in a separate account, and some require landlords to pay tenants the interest on deposits.
Landlords use the deposit to cover unpaid rent and perform needed repairs or cleaning that results from more than normal use. But your security deposit should not go towards remedying ordinary wear and tear during your occupancy. For instance, a landlord cannot withhold your deposit to pay for house cleaning, carpet cleaning, or repainting unless these chores were necessary because of your unreasonable use of the rental. You can protect your security deposit by recording the condition of the premises when you move in, by using a move-in checklist and/or taking pictures. For more information, see the article Protect Your Security Deposit When You Move In.