The short answer is yes. But it is not as simple as that either. From a Catholic view point I am going to let Fr. Gabriele Amorth,the head exorcist for the Diocese of Rome answer your question. Other denominations will see things somewhat differently.
Fr. Gabriele Amorth in his in his book An Exorcist Tells His Story (1999) gives a Catholic viewpoint of how Christians can fall victims to the powers of evil (pages 56-60).
- With God's Permission.
- When we are subject to an evil spell.
- A grave and hardened state of sin.
- Association with evil people and places.
"It is almost redundant to say that in all these stages, the way to healing can begin only with a sincere conversion (page 59)." - Fr. Amorth.
"At the root, the true cause is always a lack of faith." (page 58).
In his second book An Exorcist More Stories (2002), chapter 10 (Questions and Answers), page 195, Fr. Gabriele Amorth writes from the viewpoint of the sacrament of confession as being helpful in liberation from evil:
My pastor claims that the best exorcism is confession?
"He is right. It is the most direct means to fight Satan, because it is the sacrament that tears souls from the demon's grasp, strengthens against sin, unites us more closely to God, and helps to conform our souls increasingly to the divine will. I advise frequent confession, possibly weekly, to all victims of evil activities"
Once again this is only a Catholic perspective, as other denomination view this subject differently.