Opening a Madrasah in the Musjid

Teaching in the Musjid

Q: Is it permissible to teach in the masjid and take a wage? If it is not permissible, does this apply only within the boundary or outside as well? Does this apply if an ustaadh is given permission by the mutawalis as well?