Abdullah bin Umar reported,

The Prophet ﷺ said, "Listening and obeying are required of the Muslim, in what he likes and what he dislikes, as long as he is not commanded to commit a sin. If he is commanded to commit a sin, then there is no listening and no obeying."

Bukhari 7144

Sahih

حدثنا مسدد حدثنا يحيى بن سعيد عن عبيد الله حدثني نافع

عن عبد الله رضي الله عنه

عن النبي ﷺ قال السمع والطاعة على المرء المسلم فيما أحب وكره ما لم يؤمر بمعصية فإذا أمر بمعصية فلا سمع ولا طاعة

البخاري 7144صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Rulings
Chapter
Hearing and obeying the imam so long as it is not disobedience
Numbering
Darussalam 7144
Bukhari 7144