In a lecture on this week’s Torah portion (link, beginning minute 51), R. Hershel Schachter discusses how Ya’akov could have kissed Rachel (Gen. 29:11). He quotes R. Yerucham Gorelick as saying that it was a kiss without a kiss, i.e. it was not derekh chibah, affectionate. He goes on to say that while men should avoid physical contact with women other than their wives, it is technically permissible if there is no affection. He told a story about a student who asked him whether he (the student) was allowed to hug his great-aunt. R. Schachter said it was permitted (and that R. Mordechai Willig had previously told the student the same) but the student went on to ask R. Moshe Feinstein. He returned to R. Schachter to ask for a translation of R. Feinstein’s Yiddish response. R. Feinstein had told him something like “Zein nisht kein na’ar“, which R. Schachter translated as “Don’t act like an idiot” (i.e. it’s not a problem).
(Note that no one here permitted hugging or kissing women, even without affection, if there are no extenuating circumstances. As always, speak to a rabbi before following something you read on the internet.)