Abdullah bin Masud reported,

We used to go on campaigns with the Messenger of Allah ﷺ without our wives, so we said, "Should we not have ourselves castrated?" He forbade us from that. Then he permitted us to marry a woman for a fixed term in exchange for a garment.Then Abdullah recited, "You who believe, do not forbid the good things Allah has made lawful for you, and do not transgress. Allah does not love those who transgress" [Maidah 5:87].

Azami 6459

Sahih

عن عبد الله بن مسعود قال

كنا نغزو مع رسول الله ﷺ ليس لنا نساء، فقلنا: ألا نستخصي؟ فنهانا عن ذلك. ثم رخص لنا أن ننكح المرأة بالثوب إلى أجل. ثم قرأ عبد الله {يأيها الذين ءامنوا لا تحرموا طيبت ما أحل الله لكم ولا تعتدوا إن الله لا يحب المعتدين} [سورة المائدة: ٨٧].

الأعظمي 6459صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Marriage
Chapter
Prohibited marriages in Islam
Section
Mutah marriage and the explanation of its abrogation
Numbering
Jami al-Kamil 6459 (2nd edition)
Azami 6459