Sahih Muslim 4022
The Book of Musaqah
وَحَدَّثَنِيهِ يَحْيَى بْنُ حَبِيبٍ، حَدَّثَنَا خَالِدٌ يَعْنِي ابْنَ الْحَارِثِ، ح وَحَدَّثَنِي مُحَمَّدُ بْنُ، حَاتِمٍ حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، ح وَحَدَّثَنِي مُحَمَّدُ بْنُ الْوَلِيدِ، حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ، ح وَحَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ، أَخْبَرَنَا النَّضْرُ، ح وَحَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، حَدَّثَنَا وَهْبُ بْنُ جَرِيرٍ، كُلُّهُمْ عَنْ شُعْبَةَ، بِهَذَا الإِسْنَادِ . وَقَالَ ابْنُ حَاتِمٍ فِي حَدِيثِهِ عَنْ يَحْيَى، وَرَخَّصَ، فِي كَلْبِ الْغَنَمِ وَالصَّيْدِ وَالزَّرْعِ .
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
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.