Hadithcore
Sahih al-Bukhari, 5076
sahih

Narrated Abu Huraira:

I said, "O Allah's Messenger (ﷺ) ! I am a young man and I am afraid that I may commit illegal sexual intercourse and I cannot afford to marry." He kept silent, and then repeated my question once again, but he kept silent. I said the same (for the third time) and he remained silent. Then repeated my question (for the fourth time), and only then the Prophet (ﷺ) said, "O Abu Huraira! The pen has dried after writing what you are going to confront. So (it does not matter whether you) get yourself castrated or not."

وَقَالَ أَصْبَغُ أَخْبَرَنِي ابْنُ وَهْبٍ، عَنْ يُونُسَ بْنِ يَزِيدَ، عَنِ ابْنِ شِهَابٍ، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ ـ رضى الله عنه ـ قَالَ قُلْتُ يَا رَسُولَ اللَّهِ إِنِّي رَجُلٌ شَابٌّ وَأَنَا أَخَافُ عَلَى نَفْسِي الْعَنَتَ وَلاَ أَجِدُ مَا أَتَزَوَّجُ بِهِ النِّسَاءَ، فَسَكَتَ عَنِّي، ثُمَّ قُلْتُ مِثْلَ ذَلِكَ، فَسَكَتَ عَنِّي ثُمَّ قُلْتُ مِثْلَ ذَلِكَ، فَسَكَتَ عَنِّي ثُمَّ قُلْتُ مِثْلَ ذَلِكَ، فَقَالَ النَّبِيُّ صلى الله عليه وسلم ‏

‏ يَا أَبَا هُرَيْرَةَ جَفَّ الْقَلَمُ بِمَا أَنْتَ لاَقٍ، فَاخْتَصِ عَلَى ذَلِكَ أَوْ ذَرْ ‏

‏‏.‏

References2 variants
In-Book Reference
Book 67, Hadith 14
USC-MSA web (English) reference
Vol. 7, Book 62, Hadith 13 (deprecated numbering scheme)
Related hadiths1
Compare isnād across 1 related chains →