Can we rear dogs?
The Holy Prophet (Sallallahu alaihi wa sallam) has given warning on rearing dogs, that every day from the record of deeds good deeds will be decreased, as given in this Hadith of Jame' Tirmidhi:
Translation: It is narrated on the authority of Hadhrat Abu Hurairah (May Allah be well pleased with them) that the Holy Prophet (Sallallahu alaihi wa sallam) said: Whoever keeps a dog other than a guard dog (for guarding livestock or fields, etc.) or hunting dog, daily good deeds worth of 1 “Qeerat” (a unit of measure) will be lessened from the record of deeds. (Jame' Tirmidhi, Hadith No. 1409)
In light of this, rearing a dog only for as a hobby is not permissible. However, for protection of life, livestock and agriculture, rearing a dog is permissible. As given in Radd Ul Muhtaar, Vol. 4, Pg. No. 239.
The dog with the People of the cave (Ashab-e-Kahf) was also a guard dog, as given in the Holy Quran.
Keeping dogs for protection of life and property
Keeping a dog without any benefit is Undesirable (Makruh), but keeping a dog is permissible for a benefit as described above.
In light of this, basing on guard dogs and hunting dogs, permission is given for keeping a dog for protection of life and wealth and against thieves. As given in Fatawa A’alamgiri, Vol. 6 Pg. No. 640:
Translation: There is no problem in keeping a dog for protection against thieves etc., as keeping a dog for protection and guarding is permitted by the Shariah.
It is also mentioned in the explanatory notes of Zujaajatul Masabeeh, Vol. 3, Pg. No. 305:
Translation: Every dog can protect as it is their habit to bark on seeing wolves or thieves.