For a simple particle in a rectangular box, there will be three degrees of freedom, one for each coordinate. The box may impose potential energy constraints in the problem, but this does not affect the kinetic degrees of freedom of the particle. For example, a particle in the center of a hard box feels no constraints from the box.
The above applies for a spherical box as well. You might choose a spherical coordinate system to work such a problem, but this will not affect the three free dimensions in which the particle can translate.
For N non-interacting particles, in a box of either shape, each particle can be considered independent (non-interacting). That is, an individual particle in such a system feels no input from its neighbors. The walls of the box are thus the only confining potential for each particle and we can thus count degrees of freedom for each particle as we did in the N=1 case.
If we consider various types of objects moving around in three-dimensional boxes, we will still find that they have three translational degrees of freedom. Additional degrees of freedom can, however, exist if the objects have the additional ability to rotate (for instance, 3 degrees of freedom for three rotational Euler angles), or the ability to vibrate in certain ways.
A classic example of a more complicated object is that of a diatomic molecule (two point particles bound by a spring-like potential) for which there are 6 total degrees of freedom: three translational degrees of freedom, two rotational degrees of freedom about the axes perpendicular to the connecting spring/bond (rotation of point particles about the axis of their bond is not physical), and one vibrational (compression/expansion) degree of freedom between the particles along the axis of the bond.