Abul-Hakam related that he heard Ibn ‘Umar quote the Prophet, May Allah’s peace and blessings be on him, as saying,
“Whoever keeps a dog for other than farming, sheep herding or hunting, will have two qiraats decreased from his good deeds daily.”
Guarding human beings is more obviously permissible, because, if it is permissible to keep a dog to protect animals, cultivation and for hunting which are secondary human needs, to protect one’s home and one’s person with a dog is even more reasonable.
Al-Bukhaari (2145), Muslim (2978)
Quoted in Tafseer Soorah al-Kahf by Dr. Abu Ameenah Bilal Philips, Page 58