Ring homomorphisms which yield same endomorphisms on modules

Let $\varphi: R \rightarrow S$ be a (unital) ring homomorphism. So every left $S$-module $M$ has also a left $R$-module structure via $\varphi$ and in general we have $$\text{End}_S(M) \subseteq \text{End}_R(M)$$ My question is: Is there a necessary and sufficient condition on $\varphi$ such that the above inclusion becomes an equality for every $M$?

Note that $\varphi$ being surjective is sufficient but not necessary as $\mathbb{Z} \hookrightarrow \mathbb{Q}$ also has the desired property. This led me to believe $\varphi$ being an epimorphism in the category $\mathsf{Ring}$ is the condition I want but I couldn't show that or find a counterexample.
Edit: We can generalize the situation with $\mathbb{Z} \hookrightarrow \mathbb{Q}$: If $R$ is commutative and $D$ is a multiplicatively closed subset of $R$, the localization $R \rightarrow D^{-1}R$ has the desired property.
Moreover ring homomorphisms with this "equal endomorphisms" property are closed under composition. So any composition of surjections and localizations also works. Unfortunately there are commutative ring epimorphisms which cannot be factored to surjections and localizations, as can be seen here. (Some time I will try to work out some of the examples given there to see whether they fail to equalize the endomorphisms or not)

Edit: In general a necessary condition is that the centralizer of the image $\varphi(R)$ in $S$ should be equal to the center of $S$:
We always have $\mathbf{Z}(S) \subseteq \mathbf{C}_{S}(\varphi (R))$. For the reverse inclusion, let $u \in \mathbf{C}_S(\varphi(R))$. Then letting M be the left regular $S$-module $_S S$, the map $\alpha: S \rightarrow S$ given by $\alpha(s) = us$ lies in $\text{End}_R(M)$.
Now by assumption $\alpha$ is also an $S$-endomorphism. We know that $S$-endomorphisms of $M$ are right multiplications by elements of $S$. Say $\alpha$ is given by right multiplication by $t \in S$. Then evaluating at $1$, we get $u = t$. Thus left and right multiplications by $u$ coincide, that is $u \in \mathbf{Z}(S)$.

Note that by above, when $R$ is commutative we get $$\varphi(R) \subseteq \mathbf{C}_S(\varphi(R)) = \mathbf{Z}(S)$$ This means $S$ is an $R$-algebra via $\varphi$.
So in this case the question can be rephrased as "Let $k$ be a commutative ring and $S$ be a $k$-algebra. When can we say that $k$-linear endomorphisms of $S$-modules are always $S$-linear?" Maybe this has an easy answer when $k$ is a field.

A relevant (perhaps more natural) question to mine is when all homomorphisms are the same, not just endomorphisms. That is, can we find a (nice) condition on $\varphi$ such that for every pair of $S$-modules $M$ and $N$ the inclusion $$\text{Hom}_S(M,N) \subseteq \text{Hom}_R(M,N)$$ becomes an equality?

• The embedding $\mathbb{Z}\hookrightarrow\mathbb{Q}$ has a stronger property than being an epimorphism: the image of $\mathbb{Z}$ is fixed pointwise by every unital ring endomorphism of $\mathbb{Q}$. I don't know if that is really necessary, but it may be worth bearing in mind. – Arturo Magidin Mar 2 '12 at 17:06
• $\phi$ induces a mophism on the endomorphism rings. But in general there is no inclusion. – Curufin Mar 2 '12 at 19:13
• $\phi$ induces a mophism on the endomorphism rings. But in general there is no inclusion. Let $k$ be a finite field and $G$ a finite group. There is a morph ism $kG\rightarrow k$. Now take $M=kG$. The other inclusion also doesn't work. Take $\mathbb{F}_2\rightarrow\mathbb{F}_4$ and $M=\mathbb{F}_4$. – Curufin Mar 2 '12 at 19:26
• Curufin: When we take $\varphi$ as the augmentation map $kG \rightarrow k$ and take $M = kG$, we are considering $M$ just as a $k$-vector space. And the $kG$-module structure on $M$ induced by $\varphi$ is different that the regular one. We have $g \cdot h = \varphi(g)h = h$ for every $g,h \in G$ for instance. – Cihan Mar 2 '12 at 20:37
• A left S-module structure on an abelian group M is just a ring homomorphism $\omega:S\to\text{End}_{\mathbb{Z}}(M)$ (for $s\in S$, $\omega(s):M\to M$ is left multiplication by s). An element of $\text{End}({}_SM)$ is an abelian group homomorphism $f:M\to M$ with $f\circ \omega(s) = \omega(s)\circ f$ for all $s\in S$, i.e. $\text{End}({}_SM)$ is just the centralizer of $\text{Im}(\omega)$ in $\text{End}_{\mathbb{Z}}(M)$. The R-action induced by $\phi$ is $\omega\circ\phi$, so $\text{End}({}_RM)$ is just the centralizer of $\text{Im}(\omega\phi)$. Hence the question can be rephrased as: – Riley E Mar 2 '12 at 21:34

A relevant (perhaps more natural) question to mine is when all homomorphisms are the same, not just endomorphisms. That is, can we find a (nice) condition on $\varphi$ such that for every pair of $S$-modules $M$ and $N$ the inclusion $$\text{Hom}_S(M,N) \subseteq \text{Hom}_R(M,N)$$ becomes an equality?
Yes, this happens iff $R \to S$ is an epimorphism in the category of rings. Details and much more stuff on epimorphisms in the category of commutative rings can be found in the corresponding Séminaire Samuel. It is already quite interesting to characterize epimorphisms when $R=\mathbb{Z}$ (or more generally a Dedekind domain), see here.