Praise be to Allaah.
You do not have to stand up for someone who comes in, but it is good manners, if someone stands up for you, to shake his hand, especially the head of the household and prominent people. This is the matter of good manners. The Prophet (peace and blessings of Allaah be upon him) stood up for Faatimah, and she stood up for him, may Allaah be pleased with her. The Sahaabah (may Allaah be pleased with them) stood up, on the Prophet’s command, for Sa’d ibn Mu’aadh when he came to pass judgement on Bani Qurayzah. Talhah ibn ‘Ubayd Allaah (may Allaah be pleased with him) stood up in front of the Prophet (peace and blessings of Allaah be upon him) when Ka’b ibn Maalik (may Allaah be pleased with him) came after Allaah had accepted his repentance; he shook his hand and congratulated him, then sat down. This is the matter of good manners and this is broad issue. What is denouncable is when people stand up and remain standing by way of veneration. But if a person stands up to welcome his guest and honour him, or to shake hands with him or greet him, this is something which is prescribed in Islam. But to remain standing when people are sitting by way of veneration, or standing at the door without greeting anyone or shaking hands with anyone, this should not be done. Even worse than that is standing up to venerate a person when he is sitting down, not for the sake of guarding him but only for the purpose of veneration.
There are three kinds of standing up, as the scholars said :
(1) When people stand up for someone to venerate him when he is sitting down, as the Persians venerated their kings and leaders, as described by the Prophet (peace and blessings of Allaah be upon him). This is not permitted, and for this reason the Prophet (peace and blessings of Allaah be upon him) told them to sit down when he led them in prayer sitting down. He told them to sit down and to pray behind him seated, and when they stood up he said, “You almost venerated me like the Persians venerate their leaders.”
(2) When a person stands up when another person comes in or goes out, without greeting him or shaking hands with him, rather simply in order to venerate him. This at the very least is makrooh. The Sahaabah (may Allaah be pleased with them) used not to stand up for the Prophet (peace and blessings of Allaah be upon him) when he came in to them, because they knew that he (peace and blessings of Allaah be upon him) disliked that.
(3) When a person stands up for someone who has come in, in order to shake his hand or to take his hand and lead him to a seat, etc. There is nothing wrong with that, rather it is the Sunnah as mentioned above.