Hadithcore
Al-Adab Al-Mufrad, 1010

Abu Hurayra said, "Whoever meets his brother should greet him. If a tree or wall comes between them and then he meets him, he should greet him on the other side."

حَدَّثَنَا عَبْدُ اللهِ بْنُ صَالِحٍ قَالَ‏:‏ حَدَّثَنِي مُعَاوِيَةُ، عَنْ أَبِي مَرْيَمَ، عَنْ أَبِي هُرَيْرَةَ، أَنَّهُ سَمِعَهُ يَقُولُ‏:‏ مَنْ لَقِيَ أَخَاهُ فَلْيُسَلِّمْ عَلَيْهِ، فَإِنْ حَالَتْ بَيْنَهُمَا شَجَرَةٌ أَوْ حَائِطٌ، ثُمَّ لَقِيَهُ فَلْيُسَلِّمْ عَلَيْهِ‏.‏

References2 variants
In-Book Reference
Book 42, Hadith 47
English Reference
Book 42, Hadith 1010