Ash-Shaykh Muhammad bin Saalih al-Uthaymeen, rahimahullah, said :
أما مصافحته فإنه لا بأس بها وإن كان الأولى أيضاً عدم المصافحة، وغمزه ليشعر بأن هذا ليس موضع مصافحة؛ لأن في المصافحة نوعاً من العبث الذي قد يخرج الإنسان عن تمام الاستماع للخطبة.
“As for shaking the hands (during the khutbah) then there is no harm in it although what is better is not to shake hands (during the khutbah), rather he should indicate to him (i.e. through his body language), in order that the person realizes that this is not the time for shaking hands ; since shaking hands is a type of distraction which can take the person out of the zone of giving full attention in listening to the khutbah… ”
Reference :Majmoo’u Fataawa of al-Uthaymeen volume 16, chapter : yawmul jumah.