1) The student of knowledge must first know that Allaah has made it obligatory for him to worship Him, and worship cannot be attained except through knowledge. And he must know that it is not befitting for a Muslim to remain in ignorance. Thus, his search for knowledge is so that he may eradicate ignorance from himself and so that he may worship his Lord in the manner in which Allaah has commanded, not in the manner in which his desires deem appropriate. This should be his intention in his efforts for seeking knowledge, such that he has sincerity instilled in his heart, with regard to his exertion. He must not see any merit in his efforts, as belonging to himself, but rather he must see that all of the merit placed upon him, belongs to Allaah. This is because, with seeking knowledge, Allaah has granted him the means by which he may worship Him properly, by way of performing the obligations and abstaining from the prohibitions.
2) He must avoid all affairs that cause him to draw his attention away from the objective (of knowledge), except for those things which he must involve himself with for needs sake. Allaah says: “Allaah has not placed two hearts in the body of a man.” [Surat-ul-Ahzaab: 3] And most importantly, whenever ones thoughts are divided, he is hindered from achieving the realization of his objectives. For this reason, it is said: “Knowledge will not give you part of itself, until you first give it all of yourself.”
3) He must also begin by cleansing his soul from reprehensible manners and reprehensible characteristics. This is since knowledge is an act of worship of the heart as well as a hidden link and concealed means of drawing nearer to Allaah. Thus in the same way that prayer, which is a duty upon the visible body’s limbs, is not valid, except by performing visible purification over the filth and uncleanness, hidden acts of worship as well as rectifying the heart with knowledge is not valid, except after purifying it from filthy manners and unclean characteristics. For this reason it is said: “The heart is purified through knowledge, just as the land is purified though tilling.”
4) He must not feel proud or arrogant about the knowledge he acquires. Rather, he must display humility in front of his teacher and grant him full control to direct and supervise him in all matters. He should submit himself willingly in the same way that a sick person, that is ignorant about medicine, submits himself to a concerned and proficient doctor. And if his teacher should be younger than him in age and possess little popularity and family status, then it is only by showing humility and patience with the degrading factors of knowledge, that one can truly attain the knowledge.
5) Similarly, he must carefully select the person he is going to acquire knowledge from. He should not take knowledge, except from one whose qualifications are legitimately established, whose good religious qualities are evident, whose reputation is reliable and whose respectability is well known. Muhammad Ibn Sireen, Maalik Ibn Anas and many more of the Salaf have said: “Indeed, this knowledge is the Religion! So look carefully towards whom you take your Religion from.” 
6) He must look towards his teacher with an eye of respect and reverence, for indeed this is the best way of deriving benefit from him. When some of our Salaf would go to study with their teacher, they would give something away in charity and say: “O Allaah, conceal my teacher’s defects from me and do not cause the blessing of his knowledge to be taken away from me.”
Ar-Rabee', the companion of Ash-Shaafi'ee (rahimahullaah) would say: "I never dared to drink water in the presence of Ash-Shaafi'ee, while he was looking at me, for fear of (upsetting) him."
And it is reported that some of the predecessors used to say: “From the rights that a teacher has over you is that: You should greet all the people generally with Salaam, but specify him apart from them with a particular greeting. You should sit in front facing him. You should not point toward his direction with your hand nor should you wink at him with your eye. You should not say to him: ‘Such and such person says the opposite of what you say!’ You must not backbite anyone in his presence. You should not consult your partner’s advice while in his gathering. You should not grab onto his garment if he should rise nor should you persistently bother him if he is fatigued. And you should not mind anyone that prolongs his company with him.”
7) He should enter into the presence of his teacher with a clear and purified mind. Thus, his heart should be free of any matters that would prevent him from giving his full attention. He must not enter into his presence without first asking his permission, if his teacher is in a place which necessitates that his asking for permission be sought. He should greet those that attend his gathering with Salaam, when entering, and specify his teacher with a particularized greeting, apart from them. He should not step over the people with disregard, but rather he should sit where the rows of the gathering come to an end, until the teacher grants him permission to draw closer or he understands from the other students that are sitting that they prefer for him to advance. He should not cause anyone to get up from his place and if someone loves for him to sit in his place, then he should not accept, following the example of Ibn 'Umar radhiyallahu'anhu. This is unless there is a benefit in his sitting up front, for the ones present, or the teacher orders them to do that. He should not sit in the middle of the learning circle, unless there is a necessity. He should not sit between two companions, unless he has their permission to do so. And if space is made for him in a gathering, he should sit and crouch himself in order to fit.
8) He must be polite with his teacher's companions and those that attend his learning circle, for indeed, in doing that, he will be behaving well with the teacher and preserving the well being of the gathering. He should not raise his voice to loud tones nor should he laugh or talk too much, without any need for it. He should not fiddle with his fingers nor should he turn and peer to his right or to his left, unless he has a need to do so. Rather, he must face his teacher and devote his complete and undivided attention to his words.
9) He must safeguard and preserve his studies by being diligent and persisting in it during all times in which he has the ability to do so. He should not satisfy himself with a little when he has the ability to attain more. He should not over burden himself with things that he cannot handle, for fear that it will cause him to grow tired and postpone what he desires to attain (of knowledge). This matter varies according to each individual and his circumstances. He must exert himself severely in trying to make free time for himself, maintain vivacity and eagerness, develop a strong and healthy body, have observant and conscious mind and to possess few preoccupations, such as the obstacles that fall in one’s way when he becomes a leading figure or when he gets promoted to a high position.
'Umar Ibn Al-Khattaab radhiyallahu'anhu said: "Acquire knowledge before you become leaders. For indeed, when you become leaders, followed by the people, you will be prevented from acquiring knowledge, due to the elevation of your position and excessiveness of your preoccupations." [Kitaab-ul-‘Ilm (The Book of Knowledge) of Abu Khaithama] This statement contains the meaning of Imaam Ash-Shaafi'ee's words: "Acquire knowledge before you are given leadership, for when you become a leader, then there is no recourse for you, except knowledge."
 An authentic narration on Muhammad Ibn Sireen reported by Muslim in the introduction to his Saheeh
Source: Al-Bahr-ur-Raa’iq Fee Az-Zuhdi war-Raqaa’iq by Ahmad Fareed (pg. 39-43 of Daar-ul-Eemaan publishing) available at almanhaj.com