Question: Is it obligatory to seek permission when entering a classroom?
Answer: “This is according to the custom and agreement. If a person comes late and he seeks permission to enter or he doesn’t seek permission to enter, this is according to the custom.
As for if there is no custom, such that he enters when he wants and exits when he wants, then there is no need to seek permission. This returns to what the people are acquainted with in the classroom, whether from the teachers or those in charge. If the teacher wants that no one enter except if they seek permission, then he seeks permission. If the affair does not need seeking permission, then he enters and sits”.
[Sharh Sunan Abi Dawood no. 587]
Faisal Ibn Abdul Qaadir Ibn Hassan