The variational method is used to calculate the ground state energy of the hydrogen atom confined within hard spherical and cylindrical surfaces, for an atomic nucleus which is off the center of symmetry of the confining boundary. It is shown that the wave function for the free hydrogen atom in spherical coordinates (referred to the center of symmetry of the confining geometry) can be used without further assumptions to construct the trial wave function systematically. The latter is assumed to be the product of the free wave function and a simple cutoff function that satisfies the appropriate boundary conditions. We compute the ground state energy for these systems and the results are in good agreement with more sophisticated calculations, thus proving the reliability of the proposed strategy.