Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:19649Abū Bakr Muḥammad b. Ibrāhīm al-Ardastānī > Abū Naṣr Aḥmad b. ʿAmr al-ʿIrāqī > Sufyān b. Muḥammad al-Jawharī > ʿAlī b. al-Ḥasan > ʿAbdullāh b. al-Walīd > Sufyān > Manṣūr > Mujāhid > Abū ʿIyāḍ > ʿUmar b. al-Khaṭṭāb

[Machine] Whoever passes by a wall, let them eat in their stomach and not take a dingleberry.  

البيهقي:١٩٦٤٩أَخْبَرَنَا أَبُو بَكْرٍ مُحَمَّدُ بْنُ إِبْرَاهِيمَ الْأَرْدَسْتَانِيُّ أنبأ أَبُو نَصْرٍ أَحْمَدُ بْنُ عَمْرٍو الْعِرَاقِيُّ ثنا سُفْيَانُ بْنُ مُحَمَّدٍ الْجَوْهَرِيُّ ثنا عَلِيُّ بْنُ الْحَسَنِ ثنا عَبْدُ اللهِ بْنُ الْوَلِيدِ ثنا سُفْيَانُ ثنا مَنْصُورٌ عَنْ مُجَاهِدٍ عَنْ أَبِي عِيَاضٍ أَنَّ عُمَرَ بْنَ الْخَطَّابِ ؓ قَالَ

مَنْ مَرَّ مِنْكُمْ بِحَائِطٍ فَلْيَأْكُلْ فِي بَطْنِهِ وَلَا يَتَّخِذْ خُبْنَةً  


See similar narrations below:

Collected by Ibn Mājah, Suyūṭī
ibnmajah:2301Hadiyyah b. ʿAbd al-Wahhāb And ʾAyyūb b. Ḥassān al-Wāsiṭī Waʿalī b. Salamah Qālūā

"When anyone of you passes by a garden let him eat therefrom, but he should not carry any away in his garment."'  

ابن ماجة:٢٣٠١حَدَّثَنَا هَدِيَّةُ بْنُ عَبْدِ الْوَهَّابِ وَأَيُّوبُ بْنُ حَسَّانَ الْوَاسِطِيُّ وَعَلِيُّ بْنُ سَلَمَةَ قَالُوا حَدَّثَنَا يَحْيَى بْنُ سُلَيْمٍ الطَّائِفِيُّ عَنْ عُبَيْدِ اللَّهِ بْنِ عُمَرَ عَنْ نَافِعٍ عَنِ ابْنِ عُمَرَ قَالَ

قَالَ رَسُولُ اللَّهِ ﷺ إِذَا مَرَّ أَحَدُكُمْ بِحَائِطٍ فَلْيَأْكُلْ وَلاَ يَتَّخِذْ خُبْنَةً