The preponderant opinion to which texts indicated is:
Prohibition was ordained first then permission was given because the above mentioned Hadith of Abu Shah was narrated in the last period of the Prophet's lifetime Specifically in the year of opening Makkah for Islam in the 8th year AH.
Likewise the narration of Abu Hurayrah -who embraced Islam in the year of Khaybar that is the 7th year AH according to the most correct narrations- that `Abdullah ibn `Amr used to write, whereas he did not which indicates that `Abdullah used to write after Abu Hurayrah had embraced Islam.
Moreover, if prohibition came later, the Companions would have known that for sure and they would not have written Hadiths.
Finally, the Prophet (peace be upon him) asked them to bring a tablet and a pen while he was in his death illness to dictate them: so it is a clear indication to the permissibility of writing.
However, the prohibition of writing was for two reasons:
1- The fear of mixing the Qur'an with the Sunnah, especially both were written in one sheet.
2- The fear that people would be busy with the Sunnah and would leave the Qur'an, especially the Qur'an had not been memorized by many Companions.
It was reported from `Abdullah ibn Thabit that he said: `Umar ibn Al Khattab came to the Prophet (peace be upon him) and said: O Messenger Allah, I passed by a (Muslim) brother from Banu Qurayzhah who wrote for me some portions of Torah, shall I present them to you? He (the narrator) said: Thereupon, the face of the Messenger of Allah (peace be upon him) changed (out of anger). `Abdullah (ibn Thabit) said: I said to him: Do not you see how the face of the Messenger of Allah (peace be upon him) has changed?! `Umar said: We are well pleased with Allah as our Lord, with Islam as a religion, and with Muhammad (peace be upon him) as a Messenger. He (the narrator) said: The face of the Prophet (peace be upon him) was delighted and said: By Him in whose hand Muhammad's soul is, if Moses had come back then you followed him, you would have been misguided. You are my share of the nations and I am your share of Prophets. (1)
Khalid ibn `Arfatah said: I was sitting with `Umar when a man from `Abdul-Qays, who used to live in As-Sus (2), was brought to him. So `Umar said to him: Are you so and so? He said: Yes. said: You are the one who lives in As-Sus? He said: Yes. So, he beat him with something was with him. Then the man said: What happened, O Emir of the believers? So, `Umar said to him: Sit. The man sat. Then `Umar recited to him: In the name of Allah, the Most Gracious, the Most Merciful. "Alif Lam Ra * These are the Verses of the Clear Book (the Qur'ân that makes clear the legal and illegal things, laws, a guidance and a blessing). * Verily, We have sent it down as an Arabic Qur'ân in order that you may understand. * We relate to you (Muhammad peace be upon him) the best of stories through Our Revelations to you, of this Qur'ân. And before this (i.e. before the coming of Divine Revelation to you), you were among those who knew nothing about it (the Qur'ân)." He recited these Ayahs to him three times and hit him three times. The man said to him: What happened, O Emir of the believers? He said: You are the one who copied the Book of Daniel? He said: Command me as you wish and I shall follow you. He said: Go and erase it with Hamim (3) and white wool, then neither read it nor show it to people. If I heard that you read or showed it to the people, I shall afflict you with punishment then he said to him: Sit. so, he sat in front of him. He said: I went and copied one of the books of the Scriptures then brought it in a piece of leather. Once the Messenger (peace be upon him) saw me, he asked: What is this in your hand, O `Umar? He said: O Messenger of Allah, this is a book which I copied to add knowledge to our information. Thereupon, the Messenger of Allah (peace be upon him) got angry until his cheeks turned into red then he asked someone to call the people saying: Gather to perform Salah in congregation (a call that used to be pronounced to gather people for important matters). The Supporters said: Your Prophet (peace be upon him) got angry: Bring weapon, bring weapon. They came until they gathered around the pulpit of the Messenger of Allah (peace be upon him) then he said: O people, verily I was given Jawami` Al-Kalim (the most concise expressions carrying the most eloquent meanings) and its output, and they were made abridged to me. Indeed I brought you the religion as white and pure, so do not follow every opinion and do not let those who follow evey opinion come near you.
`Umar said: I stood up and said: I am pleased with Allah as a Lord, with Islam as a religion, and with you as a Messenger. Then the Messenger (peace be upon him) stepped down the pulpit.(4)
Az-Zuhry reported from `Urwah ibn Az-Zubayr that `Umar ibn Al Khattab wanted to write down the Sunan (Hadith compilations classified by jurisprudential themes), so he consulted the Companions of the Messenger (peace be upon him) about that and advised him to write them down. `Umar remained one month performing Istikharah (Salah for choice) then woke up one day determining to make the decision. He said: I wanted to write down the Sunnah and I recalled some people who were before you and used to write down books, so they were engaged with them and left the Book of Allah (may He be Exalted). By Allah, I will not let anything mix with the Book of Allah.(5)
(1) Reported by Imam Imam in Al Musnad (4 / 265- 266 No. 18525).
(2) As-Sus is an old town in Khuzestan in which lies the grave of Daniel (Peace be upon him). It is also a town in Morocco, other opinions were said in this regard. See: Al Mushtarik Wad`an Wal Muftariq Saq`an of Yaqut Al Hamawy p. 259, Wa Marasid Al Itila` of Safy Al Din Al Baghdady 2 / 755.
(3) Hamim is the boiling water: See: Al Nihayah Fy Gharib Al Hadith 1 / 262.
(4) Reported by Al Khatib in Taqyid Al `Ilm p. 51, 52 with his own wordings.
(5) Reported by Al Khatib in Taqyid Al `Ilm p. 49 - 51 with multiple narrations with the same wordings and meaning, and Ibn `Abdul-Bar in Jami` Bayan Al `Ilm 1 / 77, but `Urwah did not hear Hadiths form `Umar ibn Al Khattab. See: At-Tahdhib 7 / 183- 185.