One day I was riding behind the Messenger of Allah ﷺ when he said, "Young man, let me teach you some words. Be mindful of Allah, and He will protect you. Be mindful of Allah, and you will find Him before you. When you ask, ask Allah. When you seek help, seek help from Allah. Know that if the entire nation were to gather together to benefit you with something, they could not benefit you except with what Allah has already written for you. And if they were to gather together to harm you with something, they could not harm you except with what Allah has already written against you. The pens have been lifted and the pages have dried."
كنت خلف رسول الله ﷺ يوما، فقال: يا غلام إني أعلمك كلمات: احفظ الله يحفظك، احفظ الله تجده تجاهك، إذا سألت فاسأل الله، وإذا استعنت فاستعن بالله، واعلم أن الأمة لو اجتمعت على أن ينفعوك بشيء لم ينفعوك إلا بشيء قد كتبه الله لك، ولو اجتمعوا على أن يضروك بشيء لم يضروك إلا بشيء قد كتبه الله عليك، رفعت الأقلام، وجفت الصحف.
Tirmidhi (2516) reported it, "Ahmad bin Muhammad bin Musa told us, Abdullah bin Mubarak informed us, Layth bin Saad and Ibn Lahia informed us, from Qays bin Hajjaj." Another chain, "Abdullah bin Abdul-Rahman told us, Abu Walid informed us, Layth bin Saad told us, Qays bin Hajjaj told me" (the meaning is the same), "from Hanash Sanani, from Ibn Abbas," and he related it. Tirmidhi said, "Hasan sahih."Ibn Lahia has been corroborated, and it has been reported from him by Ibn Mubarak, and it was also reported from him by Ibn Wahb in al-Qadar (28), and by Firyabi in al-Qadar (153), and by Bayhaqi in al-Qada wal-Qadar (2/523) from Layth alone, with this same chain.I say, its chain of transmission is hasan because of Qays bin Hajjaj, who is Kalai Silfi. A group of narrators reported from him, and Abu Hatim said, "Reliable (salih)." Ibn Hibban mentioned him in al-Thiqat, and the Hafiz said of him, "Truthful (saduq)." As for Hanash Sanani, he is trustworthy (thiqah), and he has been corroborated, as will be quoted from Ibn Rajab. This chain is the most sahih one through which this hadith has come, and there are many other paths for it from Ibn Abbas, but what I have mentioned here is the most sahih of them.Ibn Rajab said in Jami al-Ulum wal-Hikam (1/460–461), "This hadith has been reported from Ibn Abbas through many paths, narrated by his son Ali, his freed slave Ikrima, Ata bin Abu Rabah, Amr bin Dinar, Ubaydullah bin Abdullah, Umar the freed slave of Ghufra, Ibn Abu Mulayka, and others. The most sahih of all these paths is the path of Hanash Sanani which Tirmidhi reported."I say, Firyabi reported the hadiths of some of these narrators in al-Qadar (154, 155, 156, 158), and Hakim reported it (3/541) through another route from Ibn Abbas, and in it, "And when you seek help, seek help from Allah. The pen has already finished writing what is to be. Even if people were to strive to benefit you with something Allah has not decreed for you, they would not be able to do it, and even if people were to strive to harm you with something Allah has not written against you, they would not be able to do it. If you can act with patience along with certainty, do so, and if you cannot, then be patient, for there is much good in being patient over what you dislike. Know that with patience comes victory, know that with hardship comes relief, and know that with difficulty comes ease."Hakim said, "This is a significant, elevated hadith through the narration of Abdul-Malik bin Umayr, from Ibn Abbas, except that the two sahih compilers (Sahihayn) did not include Shihab bin Kharash nor al-Qaddah in their two Sahihs. The hadith has been reported through other chains from Ibn Abbas besides this one." End of quote.Dhahabi commented on this, saying, "Al-Qaddah, Abu Hatim said of him, 'Discarded (matruk).' And Abdul-Malik did not hear directly from Ibn Abbas, as far as I can tell."Then Hakim also reported it through another route, in which Isa bin Muhammad Qurashi appears, of whom Dhahabi said, "Not to be relied upon." What appears from what Hakim did is that he did not come across the first path, even though it would have been more fitting for him to mention it. And Allah knows best.