We went out with the Prophet ﷺ when we were young men with little means. He said, "Young men, you should marry, for it lowers the gaze and guards the private parts. Whoever among you cannot marry should fast, for fasting is a shield for him."
حدثنا محمود بن غيلان حدثنا أبو أحمد الزبيري حدثنا سفيان عن الأعمش عن عمارة بن عمير عن عبد الرحمن بن يزيد
خرجنا مع النبي ﷺ ونحن شباب لا نقدر على شيء فقال يا معشر الشباب عليكم بالباءة فإنه أغض للبصر وأحصن للفرج فمن لم يستطع منكم الباءة فعليه بالصوم فإن الصوم له وجاء
Agreed upon [by Bukhari and Muslim]. Bukhari narrated it in the Book of Marriage, chapter: Whoever cannot afford marriage should fast, hadith no. 5066, and Muslim, hadith no. 1400, from the hadith of Amash, with the same wording.