“יפקד ה’ אלקי הרוחות לכל בשר איש על העדה, אשר יצא לפניהם ואשר יבא לפניהם ואשר יוציאם ואשר יביאם ולא תהיה עדת ה’ כצאן אשר אין להם רעה” (כ”ז,ט”ז-י”ז).
Rashi explains because Hashem told him to give the inheritance of צלפחד to his daughters, it was now time to make sure that his children inherited his position. Hashem told him that it would not go to his children rather יהושע would be the next leader of Klal Yisroel.
The רמ”א (סימן נ”ג סעיף כ”ה) writes that a שליח ציבור who has aged and wants his son to help him daven periodically even though his son’s voice is not as beautiful as his own, if he is considered to be ממלא מקומו in all other areas, then his son has first choice before anyone else and the congregation cannot protest. This is when it was a lifetime appointment. The רשב”א says that this applies as well to any position even if there are others who are greater than the son, as long as the son is ממלא מקומו. The רשד”ם disagrees when it comes to matters of teaching Torah or being a דיין. The עשרה מאמרות as well says that in any position of כתר תורה the children are not before anyone else. This only started from הלל הנשיא and onwards for reasons explained in the meforshim. According to the רשד”ם we must say that משה רבינו wanted his sons to inherit his מלכות not his כתר תורה.
The משנה ברורה brings the מחלוקת, however, he doesn’t rule one way or the other. The שבט הלוי says that the פסק that has been accepted by Klal Yisroel is that when the son is befitting for the job he inherits his father’s position even in regards to positions in Torah. This is in accordance with the רמב”ם (פ”א מהלכות מלכים הלכה א’) and the רמ”א (יו”ד סימן רמ”ה סכ”ב). The רמ”א writes from the ריב”ש that מי שהוחזק לרב בעיר, אפילו החזיק בעצמו באיזה שררה, אין להורידו מגדולתו אע”פ שבא לשם אחר גדול ממנו. אפילו בנו ובן בנו לעולם קודמים לאחרים, כל זמן שממלאים מקום אבותיהם ביראה והם חכמים קצת – the children of the Rav have first right to take over his position as long as they are like their father to some extent in fear of Hashem and are תלמידי חכמים. The חוט השני as well says this was always the מנהג throughout all the generations. The מכתב סופר, son of the חתם סופר, writes that in Hungary it was always the practice of his father that there is ירושה in Rabbanus. This is the opinion of most of the poskim. The שואל ומשיב says that if the son is a קטן we don’t have to hold on to the position for him וכיון דאדחי אדחי – once he is pushed away, it is for good.
There is a מחלוקת amongst the poskim if a son-in-law is considered like a son in this matter. The שו”ת הרמ”א (קל”ג) says that a son-in-law as well inherits the Rabbanus of his father-in-law. The שו”ת עבודת הגרשוני disagrees. Since the daughter is not fit to inherit the Rabbanus neither is her husband. The אשל אברהם (בוטשאטש) says that a grandson is also not considered a יורש.
Prepared by R’ Avrohom Yehoshua Ziskind
 Sources:משנה ברורה דרשו,פסקים ותשובות,אילת השחר