It is narrated from Hazrat Abu Huraira (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) said: Whoever obeys me has indeed obeyed Allah, and whoever disobeys me has disobeyed Allah. Whoever obeys the leader has obeyed me, and whoever disobeys the leader has disobeyed me. And the leader is like a shield, so when he says the takbeer, you also say the takbeer; when he bows (in ruku‘), you also bow; when he says "Sami‘ Allahu liman hamidah," you say "Rabbana lakal hamd"; and when he prays sitting, then all of you also pray sitting. So when the saying of the people of the earth coincides with the saying of the people of the heavens, his past sins are forgiven.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 10037