The Messenger of Allah ﷺ said, "Whoever keeps a dog will have one qirat deducted from his deeds each day, except for a dog used for farming or guarding livestock."
قال رسول الله ﷺ: من أمسك كلبا فإنه ينقص كل يوم من عمله قيراط إلا كلب حرث أو ماشية.
Bukhari narrated it in the Book of Cultivation and Sharecropping (2322), and Muslim in the Book of Muzaraah (1575:59), both through the route of Hisham Dastawai, who said, Yahya bin Abu Kathir told us, from Abu Salama, from Abu Hurairah, and he mentioned it.Muslim also narrated it (58) through the route of Zuhri, from Abu Salama, with the wording, "Whoever keeps a dog, other than a dog for livestock, hunting, or crops, will have one qirat deducted from his reward every day."Zuhri said, Abu Hurairah's statement was mentioned to Ibn Umar, so he said, "May Allah have mercy on Abu Hurairah, he used to be a man of crops."Hafiz said in Fath al-Bari (6/5), "It is said that Ibn Umar intended by this to point to the confirmation of Abu Hurairah's narration, and that the reason he remembered this addition while Ibn Umar did not was that he was a man of crops while Ibn Umar was not, and whoever is occupied with something needs to learn its rulings."