Chaabani, a two-time African Champions League winner with Tunisia's Esperance, was dismissed after a string of poor results left Masry in the 14th place in the Egyptian Premier League table with just 21 points from 20 games.
Masry, who are just two points clear of the relegation zone, also exited the African Confederation Cup at the quarter-final stage after losing to Morocco's RS Berkane, who went on to win the title, on the away-goal rule following a 2-2 aggregate draw in April.
Hassan, who enjoyed a glittering playing career with the Egyptian national team and Cairo giants Ahly and Zamalek, returns to the club he led on three other occasions.
He kicked off his coaching career at Masry in the 2007-08 season and had another brief spell in charge of the club in 2011-12.
His third spell was his longest and most successful at Masry, having led the team from 2015-18.
The 55-year-old helped Masry finish fourth in the Premier League and reach the Confederation Cup semi-final in 2018. He was close to domestic glory a year earlier when the Green Eagles reached the Egypt Cup final, only to lose 2-1 to Ahly.
Hassan was sacked by Alexandria-based club Ittihad in March after a poor run of results.
He made no secret of his desire to take over at the Egyptian national team following the departure of Portuguese boss Carlos Queiroz, but Ehab Galal pipped him to the post.
Hassan's usual fiery temper was cited as one of the reasons that prompted the Egyptian Football Association to snub him.
He will lead Masry for the first time when they meet second-division side Mansoura in the Egypt Cup round of 32 on Sunday.