Abu Hurairah reported,

The Prophet ﷺ said, "Whoever obeys me has obeyed Allah, and whoever disobeys me has disobeyed Allah. Whoever obeys the commander has obeyed me, and whoever disobeys the commander has disobeyed me."He did not mention, "and whoever disobeys the commander has disobeyed me."

Muslim 4748

Sahih

و حدثنيه زهير بن حرب حدثنا ابن عيينة عن أبي الزناد بهذا الإسناد ولم يذكر ومن يعص الأمير فقد عصاني

مسلم 4748صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Leadership
Chapter
Obligation of obeying leaders in matters other than disobedience and its prohibition in disobedience
Numbering
Darussalam 4748
Muslim 4748