Let $R$ be a commutative ring with identity and $M$ an $R$-module.
A group scheme over $R$ is a group object in $\mathrm{Sch}/R$, or equivalently, a group valued functor $G : \mathrm{Sch}/R \to \mathrm{Grp}$ such that $U \circ G = \mathrm{Hom}_{\mathrm{Sch}/R}(-, G)$, where $U : \mathrm{Grp} \to \mathrm{Set}$ is the forgetful functor.
Is $\mathrm{Aut}_{R}(M)$ then necessarily a group scheme?
I.e. is the functor $R$-algebras $\to \mathrm{Set}$, $S \mapsto \mathrm{Aut}(M_S) = \mathrm{Aut}(M \otimes_R S)$ representable by some scheme $S \in \mathrm{Sch}/R$?
This is certainly true when $R=k$ is a field and $M = V$ is a finite-dimensional vector space over $k$ (in this case, we obtain the algebraic group $\mathrm{GL}_n$), or more generally (I believe) for any $R$, when $M$ is a free module of finite rank.
I believe the answer is 'no' for infinite-dimensional vector spaces or non-finitely generated modules, but I have non idea how to approach such a problem.