# Given a morphism from X to Y, when is the morphism from O_Y to the pushforward of O_X injective

I would like to know under what condition the morphism $\mathcal{O}_Y\longrightarrow f_\ast \mathcal{O}_X$ induced by a morphism $f:X\longrightarrow Y$ of schemes is injective.

Let me give an example (which I'm not completely sure about though).

I believe, if $X$ and $Y$ are reduced and $f$ is surjective and closed, the morphism $\mathcal{O}_Y \longrightarrow f_\ast \mathcal{O}_X$ is injective.

(Thus, proper flat morphisms of varieties have this property.)

Maybe one could forget about schemes and give a condition for locally ringed spaces?

-

If $f$ is quasi-compact and quasi-separated then the kernel of the map $O_Y\to f_*(O_X)$ consists of locally nilpotent elements if and only if $f(X)\subset Y$ is a dense set.
This is the condition of $f$ being scheme-theoretically dominant. (If $f$ satisfies the closely related condition considered in LRG's answer, of having dense image, one says that $f$ is dominant.) These conditions are discussed very carefully in the stacks project. (Google "stacks project" if you don't know the link already.) (Also, the precise definitions may involve finiteness conditions that I am omitting here; the stacks project write-up will have complete details.)