From 1942 to 1944 Henss served as a guard at the Dachau and Buchenwald concentration camps , where he instructed other guards in the use of trained attack dogs to guard prisoners and prevent their escape , authorities said .