Sahih Muslim 1573
Sahih Muslim · Book 22: The Book of Musaqah · The command to kill dogs, and its abrogation. The prohibition of keeping dogs, except for hunting, farming, (herding) livestock and the like
وَحَدَّثَنِيهِ يَحْيَى بْنُ حَبِيبٍ ، حَدَّثَنَا خَالِدٌ يَعْنِي ابْنَ الْحَارِثِ ، ح وَحَدَّثَنِي مُحَمَّدُ بْنُ، حَاتِمٍ حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ ، ح وَحَدَّثَنِي مُحَمَّدُ بْنُ الْوَلِيدِ ، حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ ، ح وَحَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ ، أَخْبَرَنَا النَّضْرُ ، ح وَحَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى ، حَدَّثَنَا وَهْبُ بْنُ جَرِيرٍ ، كُلُّهُمْ عَنْ شُعْبَةَ ، بِهَذَا الإِسْنَادِ . وَقَالَ ابْنُ حَاتِمٍ فِي حَدِيثِهِ عَنْ يَحْيَى، وَرَخَّصَ، فِي كَلْبِ الْغَنَمِ وَالصَّيْدِ وَالزَّرْعِ .
In the hadith transmitted on the authority of Yahya, he (the Holy Prophet) permitted the keeping of dogs for (the protection of) herds, for hunting and (the protection of) cultivated land.