The Prophet ﷺ passed by him at Hudaybiyyah, before entering Makkah, while he was in a state of ihram. He was kindling a fire beneath a cooking pot, and lice were falling onto his face.The Prophet ﷺ asked, "Are these vermin troubling you?"He replied, "Yes."The Prophet ﷺ said, "Shave your head, and feed six poor people with a faraq, which is three saa, or fast three days, or offer a sacrifice."Ibn Abu Najeeh said, "Or slaughter a sheep."
حدثنا ابن أبي عمر حدثنا سفيان بن عيينة عن أيوب السختياني وابن أبي نجيح وحميد الأعرج وعبد الكريم عن مجاهد عن عبد الرحمن بن أبي ليلى
أن النبي ﷺ مر به وهو بالحديبية قبل أن يدخل مكة وهو محرم وهو يوقد تحت قدر والقمل يتهافت على وجهه فقال أتؤذيك هوامك هذه فقال نعم فقال احلق وأطعم فرقا بين ستة مساكين والفرق ثلاثة آصع أو صم ثلاثة أيام أو انسك نسيكة قال ابن أبي نجيح أو اذبح شاة
Muslim also reported it in the book of Hajj, chapter on the permissibility of shaving the head for one in ihram if he has an ailment... etc, hadith 1201, from Muhammad bin Abu Muhammad bin Abu Umar, with this wording. Bukhari also reported it, hadith 1814, from the hadith of Humayd Aaraj, with this wording.