Muhammad said: It has been said regarding His saying: "nor upon yourselves that you eat from your houses": He meant from the wealth of your wives and from the property of your homes, and Allah knows best. "There is no blame upon you that you eat together or separately." Qatada's interpretation: He said that the Banu Kinana used to believe that it was forbidden for one of them to eat [alone] in [the Jahiliyyah], to the point that a man would drive [a herd of milch camels] while he was hungry until he found someone to eat and drink with. A man would even set up a dummy (effigy) next to him if he could not find someone to eat or drink with, so Allah revealed this verse. "But when you enter houses, give greetings of peace upon yourselves," meaning: some of you should greet others. When a man enters his own house, he should greet those within it. And if he enters a house in which there is no one, he should say: "Peace be upon us and upon the righteous servants of Allah."
Qatada said: We were told that the angels respond to him. When he enters upon a people, he should greet them. When he leaves them, he should greet them, and if he passes by them or encounters them, he should greet them. Even if it is only one man, he should greet him. When he enters the mosque, he should say: "In the name of Allah, peace be upon the Messenger of Allah. O Allah, forgive my sin and open for me the gates of Your mercy." If the mosque is crowded, he should greet them in a way that he hears his own voice, and if they are few, he should make them hear the greeting, and if there is no one in it [he should say the previously mentioned phrase].