Let $K$ be a number field, $\mathcal{O}_K$ its ring of integers, $\mathfrak{p} \subset \mathcal{O}_K$ a prime ideal, and $f:K \to K$ an automorphism.
If we have $f(x) \equiv x\ (\textrm{mod}\ \mathfrak{p})$ for all $x \in \mathcal{O}_K$, can we conclude that $f(x) = x$ for all $x \in K$?
My idea was to show that if $\mathfrak{p} \mid f(x) -x$ for all $x \in \mathcal{O}_K$ then $f(x)-x = 0$ for all $x \in \mathcal{O}_K$, and thence somehow conclude that $f(x) - x = 0$ for all $x \in K$.
Assume for convenience that $K$ is Galois. Denote the automorphism by $\sigma$. First of all, it is true that automorphisms preserve the ring of integers. Your condition implies that if $y \in \mathfrak{p}$ then so is $\sigma y$, which implies that $\sigma$ fixes $\mathfrak{p}$. By definition, that means it lives inside the decomposition group $D_{\mathfrak{p}}$ of $\mathfrak{p}$. There is a map from this group to the automorphisms of the residue field $\mathcal{O}_K/\mathfrak{p}$, and in fact there is an exact sequence:
$$0 \rightarrow I_{\mathfrak{p}} \rightarrow D_{\mathfrak{p}} \rightarrow \mathrm{Gal}(\mathcal{O}_{K}/\mathfrak{p}) \rightarrow 0.$$
Your question is whether $I_{\mathfrak{p}}$ is trivial. It is if and only if the prime $\mathfrak{p}$ is unramified. In particular, it is true for all but finitely many such primes, but not always for all.
Example: Take $K = \mathbf{Q}(i)$ and $\mathfrak{p} = (1+i)$, so $\mathcal{O}_K/\mathfrak{p} = \mathbf{F}_2$. Then complex conjugation $\sigma(a+bi) = \sigma(a-bi)$ is non-trivial but is trivial modulo $\mathfrak{p}$. In the context of the groups above, $I = D = \mathrm{Gal}(\mathbf{Q}(i)/\mathbf{Q})$. Indeed $(2) = (1+i)^2$ is ramified in this case.