Ibn Mas'ud (May Allah be pleased with him) reported:
The Prophet (ﷺ) said, "Envy is permitted only in two cases: A man whom Allah gives wealth, and he disposes of it rightfully, and a man to whom Allah gives knowledge which he applies and teaches it."[Al- Bukhari and Muslim]. (RU)
App reference (RU): Book 13, Hadith 2 (RU)
Arabic/English book reference (RU): Book 13, Hadith 1377 (RU)