The shear force from a gold or a graphite sample acting on an approaching n
ear-field optical probe is studied in detail. The adiabatic and dissipative
contributions to the force are clearly distinguished by monitoring the amp
litude as well as the phase of the tip vibration when the tip approaches th
e surfaces. We also take into account that not only the damping and the res
onance frequency but also the mass of the system changes when the tip appro
aches the surface. The relative strength of the contributions to the force
varies differently but characteristically with the distance of the two samp
les, starting at a much larger distance in the case of graphite. Tile adiab
atic contribution is larger in the case of the gold sample. Measurements at
various temperatures are performed using the gold sample, showing a depend
ence of the shear force on the varying conditions.