كتاب المساقاة
22  
The Book of Musaqah
(10)
Chapter: The command to kill dogs, and its abrogation. The prohibition of keeping dogs, except for hunting, farming, (herding) livestock and the like
(10)
بَاب الْأَمْرِ بِقَتْلِ الْكِلَابِ وَبَيَانِ نَسْخِهِ وَبَيَانِ تَحْرِيمِ اقْتِنَائِهَا إِلَّا لِصَيْدٍ أَوْ زَرْعٍ أَوْ مَاشِيَةٍ وَنَحْوِ ذَلِكَ
Sahih Muslim 1571

Ibn Umar (Allah be pleased with them) reported that Allah's Messenger (may peace be, upon him) ordered the killing of dogs except the dog tamed for hunting, or watching of the herd of sheep or other domestic animals. It was said to Ibn Umar (Allah be pleased with them) that Abu Huraira (Allah be pleased with him) talks of (exception) about the dog for watching the field, whereupon he said:

Since Abu Huraira (Allah be pleased with him) possessed land.
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، أَخْبَرَنَا حَمَّادُ بْنُ زَيْدٍ، عَنْ عَمْرِو بْنِ دِينَارٍ، عَنِ ابْنِ عُمَرَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم أَمَرَ بِقَتْلِ الْكِلاَبِ إِلاَّ كَلْبَ صَيْدٍ أَوْ كَلْبَ غَنَمٍ أَوْ مَاشِيَةٍ ‏.‏ فَقِيلَ لاِبْنِ عُمَرَ إِنَّ أَبَا هُرَيْرَةَ يَقُولُ أَوْ كَلْبَ زَرْعٍ ‏.‏ فَقَالَ ابْنُ عُمَرَ إِنَّ لأَبِي هُرَيْرَةَ زَرْعًا.
Reference : Sahih Muslim 1571
In-book reference : Book 22, Hadith 58
USC-MSA web (English) reference : Book 10, Hadith 3812
  (deprecated numbering scheme)