HONORING ONE'S REBBI [Rebbi:honor]
Gemara
(R. Yehoshua ben Levi): A Talmid does for his Rebbi all tasks that a slave does for his master, except for untying his shoe (lest people think that the Talmid is a slave).
(Rava): This is only in a place where people do not recognize him. Where people recognize him, it is no problem.
(Rav Ashi): Even where people do not recognize him, it is a problem only if the Talmid is not wearing Tefilin (slaves do not wear Tefilin).
(R. Chiya bar Avin): Anyone who prevents his Talmid from serving him withholds from him Chesed - "he withholds Chesed from his friend."
(Rav Nachman bar Yitzchak): He removes fear of Shamayim from him - "he (causes that he) abandons fear of Hash-m".
Berachos 7b (R. Yochanan): Shimush (service of) Chachamim is greater than learning Torah -- "Po Elisha... Asher Yatzak Mayim Al Yedei Eliyahu";
It does not say that he learned from him, rather, that he poured water on his hands, for this is greater.
27a (Rav Yehudah): One may not pray even with his Rebbi or in back of him.
(Beraisa - R. Eliezer): The following cause the Shechinah to depart from Yisrael:
One who prays in back of his Rebbi, gives or returns a greeting of Shalom to his Rebbi, argues with his Rebbi's teaching, or says something that he did not hear from his Rebbi.
Rishonim
The Rif and Rosh (Kidushin 14a and Kesuvos 10:2)bring the Gemara in Kesuvos (their text also forbids putting shoes on the Rebbi).
The Rif and Rosh (Berachos 18b and 4:5) bring the Gemara in Berachos 27 (their text omits 'returning Shalom').
R. Yonah (DH Al): One may not pray in back of his Rebbi, lest the Rebbi need to wait for the Talmid to finish before he can step back. Praying even with him shows that he equates himself to his Rebbi. Certainly one may not (pray in front and) step back near his Rebbi, for this is disgraceful. Outside his four Amos is permitted.
Rosh: Rashi says that he greets his Rebbi the same way he greets others. He does not say 'Shalom Alecha Rebbi.' The Yerushalmi connotes that one may not greet him at all. However, the Bavli disagrees. One may not say in his Rebbi's name something that he did not hear from his Rebbi.
Rambam (Hilchos Talmud Torah 5:5): One may not greet or answer his Rebbi the way friends greet and answer each other. Rather, he bows in front of him and says, with fear and honor, 'Shalom Alecha Rebbi.' When answering, he says 'Shalom Alecha Rebbi u'Mori.'
Rambam (6): One may not pray in front of, in back of his Rebbi, or to the side of his Rebbi. He must be in back of him, and not directly in back of him.
Rambam (8): A Talmid does for his Rebbi all tasks that a slave does for his master. If people do not know recognized the Talmid in this place, and he is not wearing Tefilin, he does not put shoes on his Rebbi or take them off. Anyone who prevents his Talmid from serving him withholds from him Chesed and removes fear of Shamayim from him. Any Talmid who disgraces any matter of honoring his Rebbi causes the Shechinah to depart from Yisrael.
Rambam (Hilchos Avadim 1:7): If a Yisrael bought an Eved Ivri, he may not make him do disgraceful tasks special for (Kena'ani) slaves, e.g. to carry the master's clothes to the bathhouse or remove his shoes. This refers to an Eved Ivri, for he feels lowly due to the sale. If a Yisrael was not sold, one may use him like a slave, for the Yisrael does so willingly.
Kesef Mishneh: The Mechilta permits a Talmid do such things for his Rebbi. The Rambam gives a reason why the same applies to other people.
Poskim
Shulchan Aruch (YD 242:16): One does not give Shalom to his Rebbi like he does to others. Rather, he bows and says with awe and honor 'Shalom Alecha Rebbi', or when returning Shalom, 'Shalom Alecha Rebbi v'Mori' (Taz).
Rema: This is the custom. Some say that a Talmid should not greet his Rebbi at all - "Ra'uni Ne'arim v'Nechba'u."
Shulchan Aruch (19): A Talmid does for his Rebbi all tasks that a slave does for his master. If people do not know recognize the Talmid in this place, and he is not wearing Tefilin on his head and he is concerned lest people say that he is a slave, he does not put shoes on his Rebbi or take them off.
Erech Lechem: If one's Rebbi drank from a cup, it is not heresy to spill water from it before drinking (Tamid 27b).
Einayim l'Mishpat (Berachos 7b DH Gedolah): Avi ha'Ezri says that serving is greater than learning because one learns Halachah in practice. Why did the Poskim omit this? Tosfos (Kesuvos 17a DH Mevatlin) says that to bury a Mes Mitzvah we cease learning, but we do not cease serving Chachamim.
Shulchan Aruch (20): One who prevents his Talmid from serving him withholds Chesed and removes fear of Shamayim from him. Any Talmid who disgraces any matter of honoring his Rebbi causes the Shechinah to depart from Yisrael.
Beis Yosef (DH u'Mah she'Chosav V'Chol): The Rambam learns from Berachos 27b.
Erech Lechem: A Talmid is obligated to protest to defend the honor of his Rebbi.
Shulchan Aruch (OC 90:24): One may not pray next to his Rebbi, nor in back of him or in front of him. He goes far in back of him, to the side.
Beis Yosef (DH v'Lo Yispalel): Tosfos says that if one prays in back of his Rebbi, it looks like he bows to his Rebbi.
Mishnah Berurah (73): This refers to the Rebbi from whom he learned most of his Chachmah, or the Gadol ha'Dor. The Chayei Adam says that the same applies to one's father.
Rema: Some say that this is when praying without a Minyan, but there is no Isur b'Tzibur if it is his normal place to pray in front of or in back of him. Even though it is good to be stringent, the custom is to be lenient.
Beis Yosef (DH Kasuv): Rav Hai Gaon says that there is no Isur b'Tzibur. Then, one does not show honor his Rebbi, and he may pray in back of him.
Beis Yosef (OC 90 DH v'Chosav Rabeinu): Mahari Avuhav and Ohel Mo'ed say that if one's normal place to pray b'Tzibur is in back of his Rebbi, there is no concern that he worships him. However, if the problem is causing his Rebbi to wait for him to finish, this still applies. In practice, one should be stringent even b'Tzibur.
Mishnah Berurah (78): It is good to fix a place in the Beis ha'Keneses at least four Amos and three steps in back of one's Rebbi, lest he pain his Rebbi.
Shulchan Aruch (ibid.): If he distances four Amos, there is no problem.
Beis Yosef (DH u'Mah she'Chosav v'Im): R. Yonah and the Rosh learn this from the episode with R. Yirmeyah (Berachos 27b). It says there (regarding passing in front of one praying) that outside four Amos is a different Reshus. However, it seems that this permits praying in back, but even very much in front is forbidden.
Beis Yosef (DH v'Amrinan): Even a Talmid Chaver may not pray with his back to his Rebbi. This is a big disgrace.
Mishnah Berurah (80): In YD (242:16) it says that four Amos permits 'everything', i.e. even in front. The Acharonim agree.
Kaf ha'Chayim (144): When possible one should be stringent like the Beis Yosef.