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.
عَنْ يَحْيَى وَرَخَّصَ فِي كَلْبِ الْغَنَمِ وَالصَّيْدِ وَالزَّرْعِ