Abdullah bin Umar reported,

Umar acquired a piece of land at Khaybar, so he came to the Prophet ﷺ and said, "I have acquired a piece of land. I have never obtained any property more valuable to me than this. What do you command me to do with it?"The Prophet ﷺ replied, "If you wish, you may preserve the land itself and give its produce in charity."So Umar gave it as charity, stipulating that the land itself was not to be sold, gifted, or inherited. Its yield was to be spent on the poor, on relatives, on freeing slaves, in the way of Allah, on guests, and on travelers. There would be no blame upon whoever administers it if he eats from it in a reasonable manner or feeds a friend, without amassing wealth from it.

Bukhari 2772

Sahih

حدثنا مسدد حدثنا يزيد بن زريع حدثنا ابن عون عن نافع

عن ابن عمر رضي الله عنهما قال

أصاب عمر بخيبر أرضا فأتى النبي ﷺ فقال أصبت أرضا لم أصب مالا قط أنفس منه فكيف تأمرني به قال إن شئت حبست أصلها وتصدقت بها فتصدق عمر أنه لا يباع أصلها ولا يوهب ولا يورث في الفقراء والقربى والرقاب وفي سبيل الله والضيف وابن السبيل لا جناح على من وليها أن يأكل منها بالمعروف أو يطعم صديقا غير متمول فيه

البخاري 2772صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Bequests
Chapter
How a waqf is written
Numbering
Darussalam 2772
Bukhari 2772