It was narrated from 'Abdullah bin Mughaffal that the Prophet (ﷺ) said:
"Whoever digs a well, is entitled to forty forearms' length surrounding it is as a resting place for his flocks." (JA)
English reference (JA): Vol. 3, Book 16, Hadith 2486 (JA)
Arabic reference (JA): Book 16, Hadith 2580 (JA)