Application of the density functional formalism to the canonical ensemble is of practical interest in cases where there is a marked difference between, say, the canonical and the grand canonical ensemble (cavities or pores). An important role is played by the necessary modification of the famous Ornstein-Zernike relation between pair correlation and direct correlation function, as the former is no longer invertible in a strict sense in (finite) canonical ensembles. Here we approach the problem from a different direction which may complement the density functional approach. In particular, we develop rigorous canonical ensemble versions of the LMBW equations, relating density gradient and exterior potential in the presence of explicit (singular) containing potentials. This is accomplished with the help of integral operator and Hilbert space methods, yielding among other things representations of the direct correlation function on certain subspaces. The results are particularly noteworthy and transparent if the segregating potential is a linear (gravitational) one. In that case the modifications in the LMBW equations can be expressed as pure, seemingly non-local integrations over the container boundaries.