The 47-year-old Ceni holds the record for most goals scored by a keeper (131) and was part of the Brazil squad that won the 2002 FIFA World Cup.
Ceni left his post as Fortaleza boss shortly after Torrent was dismissed. He has signed a contract with Flamengo until December 2021.
Torrent, 58, was dismissed after two heavy defeats in a row.
He had been hired in July to replace Jorge Jesus, who returned to Benfica after leading Flamengo to the league and Copa Libertadores titles last year.
Ceni takes over a side third in Brazil's top flight, one point off the lead, and through to the last 16 of the Libertadores.