I've done this before with a piece of thin copper tubing, maybe about 1/2" OD, and a cylindrical neodymium magnet that just passed through the copper tubing, with about .100" clearance. The magnet stays, or tries to stay, in the center of the tubing leaving an even gap around all sides of it, never touching the tubing, all because of the magnetic field it generates around it.