The Messenger of Allah ﷺ said, "The imam is appointed only to be followed. When he says the takbir, say the takbir. When he recites, listen quietly. When he says, 'Allah hears whoever praises Him,' say, 'O Allah, our Lord, to You belongs all praise.'"
أخبرنا الجارود بن معاذ الترمذي قال حدثنا أبو خالد الأحمر عن محمد بن عجلان عن زيد بن أسلم عن أبي صالح
قال رسول الله ﷺ إنما جعل الإمام ليؤتم به فإذا كبر فكبروا وإذا قرأ فأنصتوا وإذا قال سمع الله لمن حمده فقولوا اللهم ربنا لك الحمد
[Sahih] Reported by Abu Dawud, Prayer, chapter on the imam praying while sitting, no. 604, and Ibn Majah, no. 846, from the hadith of Abu Khalid, and it is in Kubra, no. 993.