  For a positive integer $N$, let $\mathscr C(N)$ be the subgroup of $J_0(N)$
generated by the equivalence classes of cuspidal divisors of degree $0$ and
$\mathscr C(N)(\mathbb Q):=\mathscr C(N)\cap J_0(N)(\mathbb Q)$ be its $\mathbb
Q$-rational subgroup. Let also $\mathscr C_{\mathbb Q}(N)$ be the subgroup of
$\mathscr C(N)(\mathbb Q)$ generated by $\mathbb Q$-rational cuspidal divisors.
We prove that when $N=n^2M$ for some integer $n$ dividing $24$ and some
squarefree integer $M$, the two groups $\mathscr C(N)(\mathbb Q)$ and $\mathscr
C_{\mathbb Q}(N)$ are equal. To achieve this, we show that all modular units on
$X_0(N)$ on such $N$ are products of functions of the form $\eta(m\tau+k/h)$,
$mh^2|N$ and $k\in\mathbb Z$ and determine the necessary and sufficient
conditions for products of such functions to be modular units on $X_0(N)$.
