The Messenger of Allah ﷺ said, "When the imam says 'Allah is the Greatest,' say it as well. When he bows, bow. When he prostrates, prostrate. And when he prays sitting, pray sitting."
وبإسناده قال رسول الله ﷺ إذا كبر الإمام فكبروا وإذا ركع فاركعوا وإذا سجد فاسجدوا وإذا صلى جالسا فصلوا جلوسا
Its isnad is sahih. It is found in the Sittah, and it has already occurred at 9617. As for his statement, "and if he prays sitting, then pray sitting," some jurists interpreted it and did not consider this to be of an obligatory nature. Some of them also faulted this hadith because of Abu Salama, the narrator from Abu Hurairah.