Sahih al-Bukhari, Volume 5, Book 57, Hadith 1 (USC-MSA) ⓘ
Narrated Abu Sa`id Al-Khudri: "Allah's Messenger said, "A time will come upon the people, when a group of people will wage a holy war and it will be said, 'Is there amongst you anyone who has accompanied Allah's Messenger?' They will say, 'Yes.' And so victory will be bestowed on them. Then a time will come upon the people when a group of people will wage a holy war, and it will be said, "Is there amongst you anynone who has accompanied the companions of Allah's Messenger?' They will say, 'Yes.' And so victory will be bestowed on them. Then a time will come upon the people when a group of people will wage a holy war, and it will be said, "Is there amongst you anyone who has been in the company of the companions of the companions of Allah's Messenger ?' They will say, 'Yes.' And victory will be bestowed on them."
حَدَّثَنَا عَلِيُّ بْنُ عَبْدِ اللَّهِ، حَدَّثَنَا سُفْيَانُ، عَنْ عَمْرٍو، قَالَ سَمِعْتُ جَابِرَ بْنَ عَبْدِ اللَّهِ ـ رضى الله عنهما ـ يَقُولُ حَدَّثَنَا أَبُو سَعِيدٍ الْخُدْرِيُّ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " يَأْتِي عَلَى النَّاسِ زَمَانٌ فَيَغْزُو فِئَامٌ مِنَ النَّاسِ، فَيَقُولُونَ فِيكُمْ مَنْ صَاحَبَ رَسُولَ اللَّهِ صلى الله عليه وسلم فَيَقُولُونَ نَعَمْ. فَيُفْتَحُ لَهُمْ. ثُمَّ يَأْتِي عَلَى النَّاسِ زَمَانٌ فَيَغْزُو فِئَامٌ مِنَ النَّاسِ، فَيُقَالُ هَلْ فِيكُمْ مَنْ صَاحَبَ أَصْحَابَ رَسُولِ اللَّهِ صلى الله عليه وسلم فَيَقُولُونَ نَعَمْ. فَيُفْتَحُ لَهُمْ، ثُمَّ يَأْتِي عَلَى النَّاسِ زَمَانٌ فَيَغْزُو فِئَامٌ مِنَ النَّاسِ، فَيُقَالُ هَلْ فِيكُمْ مَنْ صَاحَبَ مَنْ صَاحَبَ أَصْحَابَ رَسُولِ اللَّهِ صلى الله عليه وسلم فَيَقُولُونَ نَعَمْ. فَيُفْتَحُ لَهُمْ " .
also referenced under: Book 62, Hadith 1 (In-Book) & Hadith 3649 (DarusSalam)