We consider a class of second order hypoelliptic ultraparabolic partial differential equations, a typical example of which is the Fokker-Plank equation. We find a sufficient condition on compact sets K such that Harnack's inequality holds on K for all nonnegative solutions. This condition is geometric and it is described in terms of paths connecting couples of points.The proof uses a local invariant Harnack inequality proved by Kogoj and Lanconelli on cylinders and a construction with chains ofcylinders. These results are related with the corresponding ones appearing in potential theory. It is also shown for an explicit operator of the type considered that the condition on the compact sets is optimal