(Imām Bukhārī narrates): Abū al-Yamān narrated to us, he said: Shu'aib informed us, he said: Abū al-Zinād informed us, from al-A'raj, from Abū Hurairah, may Allāh be pleased with him, he narrates that the Prophet ﷺ said:
The imām is appointed only so that he may be followed; so when he pronounces the takbīr, you pronounce the takbīr; and when he performs rukū', you perform rukū'; and when he says "Sami'a Allāhu liman hamidah", you say "Rabbanā wa laka al-hamd"; and when he performs sajdah, you perform sajdah; and when he prays sitting, all of you pray sitting.
حَدَّثَنَا أَبُو الْيَمَانِ، قَالَ أَخْبَرَنَا شُعَيْبٌ، قَالَ حَدَّثَنِي أَبُو الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم " إِنَّمَا جُعِلَ الإِمَامُ لِيُؤْتَمَّ بِهِ، فَإِذَا كَبَّرَ فَكَبِّرُوا، وَإِذَا رَكَعَ فَارْكَعُوا، وَإِذَا قَالَ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ. فَقُولُوا رَبَّنَا وَلَكَ الْحَمْدُ. وَإِذَا سَجَدَ فَاسْجُدُوا، وَإِذَا صَلَّى جَالِسًا فَصَلُّوا جُلُوسًا أَجْمَعُونَ ".
Reference: Sahih Al Bukhari 734