Swami Vivekananda says in Bhakti Yoga that there are certain qualifications to be a teacher, just as there are qualifications to be a disciple. He mentions three qualifications for a teacher. He says (Complete Works, V3, Bhakti Yoga, Qualifications of the Aspirant and the Teacher - http://cwsv.belurmath.org/volume_3/vol_3_frame.htm):
...The teachers whose wisdom and truth shine like the light of the sun are the very greatest the world has known, and they are worshipped as God by the major portion of mankind. But we may get help from comparatively lesser ones also; only we ourselves do not possess intuition enough to judge properly of the man from whom we receive teaching and guidance; so there ought to be certain tests, certain conditions, for the teacher to satisfy, as there are also for the taught.
In regard to the teacher, we must see that he knows the spirit of the scriptures. The whole world reads Bibles, Vedas, and Korans; but they are all only words, syntax, etymology, philology, the dry bones of religion. The teacher who deals too much in words and allows the mind to be carried away by the force of words loses the spirit. It is the knowledge of the spirit of the scriptures alone that constitutes the true religious teacher. The network of the words of the scriptures is like a huge forest in which the human mind often loses itself and finds no way out. — "The network of words is a big forest; it is the cause of a curious wandering of the mind." "The various methods of joining words, the various methods of speaking in beautiful language, the various methods of explaining the diction of the scriptures are only for the disputations and enjoyment of the learned, they do not conduce to the development of spiritual perception"...
The second condition necessary in the teacher is — sinlessness. The question is often asked, "Why should we look into the character and personality of a teacher? We have only to judge of what he says, and take that up." This is not right. If a man wants to teach me something of dynamics, or chemistry, or any other physical science, he may be anything he likes, because what the physical sciences require is merely an intellectual equipment; but in the spiritual sciences it is impossible from first to last that there can be any spiritual light in the soul that is impure. What religion can an impure man teach? The sine qua non of acquiring spiritual truth for one's self or for imparting it to others is the purity of heart and soul. A vision of God or a glimpse of the beyond never comes until the soul is pure. Hence with the teacher of religion we must see first what he is, and then what he says. He must be perfectly pure, and then alone comes the value of his words, because he is only then the true "transmitter". What can he transmit if he has not spiritual power in himself? There must be the worthy vibration of spirituality in the mind of the teacher, so that it may be sympathetically conveyed to the mind of the taught. The function of the teacher is indeed an affair of the transference of something, and not one of mere stimulation of the existing intellectual or other faculties in the taught. Something real and appreciable as an influence comes from the teacher and goes to the taught. Therefore the teacher must be pure.
The third condition is in regard to the motive. The teacher must not teach with any ulterior selfish motive — for money, name, or fame; his work must be simply out of love, out of pure love for mankind at large. The only medium through which spiritual force can be transmitted is love. Any selfish motive, such as the desire for gain or for name, will immediately destroy this conveying median. God is love, and only he who has known God as love can be a teacher of godliness and God to man.
When you see that in your teacher these conditions are all fulfilled, you are safe; if they are not, it is unsafe to allow yourself to be taught by him, for there is the great danger that, if he cannot convey goodness to your heart, he may convey wickedness. This danger must by all means be guarded against. — "He who is learned in the scriptures, sinless, unpolluted by lust, and is the greatest knower of the Brahman" is the real teacher.
Vivekananda iterates these three qualifications again in another lecture. He says (Complete Works, V3, Lectures from Colombo to Almora, The Vedanta in all its phases - http://cwsv.belurmath.org/volume_3/vol_3_frame.htm)
What is a Guru? Let us go back to the Shrutis — "He who knows the secret of the Vedas", not bookworms, not grammarians, not Pandits in general, but he who knows the meaning. - An ass laden with a load of sandalwood knows only the weight of the wood, but not its precious qualities"; so are these Pandits. We do not want such. What can they teach if they have no realisation? When I was a boy here, in this city of Calcutta, I used to go from place to place in search of religion, and everywhere I asked the lecturer after hearing very big lectures, "Have you seen God?" The man was taken aback at the idea of seeing God; and the only man who told me, "I have", was Ramakrishna Paramahamsa, and not only so, but he said, "I will put you in the way of seeing Him too". The Guru is not a man who twists and tortures texts — "Different ways of throwing out words, different ways of explaining texts of the scriptures, these are for the enjoyment of the learned, not for freedom." Shrotriya, he who knows the secret of the Shrutis, Avrijina, the sinless, and Akâmahata, unpierced by desire — he who does not want to make money by teaching you — he is the Shânta, the Sâdhu, who comes as the spring which brings the leaves and blossoms to various plants but does not ask anything from the plant, for its very nature is to do good. It does good and there it is. Such is the Guru, — "Who has himself crossed this terrible ocean of life, and without any idea of gain to himself, helps others also to cross the ocean." This is the Guru, and mark that none else can be a Guru, for — "Themselves steeped in darkness, but in the pride of their hearts, thinking they know everything, the fools want to help others, and they go round and round in many crooked ways, staggering to and fro, and thus like the blind leading the blind, both fall into the ditch." Thus say the Vedas.
As Vivekananda says, if your teacher has these three qualifications, then you are safe.