Ref. No. 38 / 1145
In the name of Allah the most gracious the most Merciful
The answer to your question is as follows:
A Muslim is not allowed to greet or reply to a non-mahram girl’s greeting and also shaking hands with them is strictly prohibited in Islam. Haram is Haram. It will remain Haram even if you do it with good intention.
And Allah knows best
Darul Uloom Waqf Deoband