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."
حدثنا مسدد حدثنا يحيى بن سعيد عن عبيد الله حدثني نافع
عن النبي ﷺ قال السمع والطاعة على المرء المسلم فيما أحب وكره ما لم يؤمر بمعصية فإذا أمر بمعصية فلا سمع ولا طاعة