All-rounder Mohammad Mahmudullah was named Rahim s deputy, Bangladesh Cricket Board (BCB) spokesman Rabeed Imam said.
"Rahim will captain the national team for Tests and limited-over matches for the home series against the West Indies and Pakistan," he said.
"The West Indies will tour from October and Pakistan from the last week of November."
Wicket-keeper Rahim, a former vice-captain, had a brilliant series in Zimbabwe last month when he hit his first century in one-day internationals.
He was singled out as a likely choice for captaincy after the BCB sacked regular captain Shakib Al Hasan and vice-captain Tamim Iqbal early this month following the team s unsuccessful tour of Zimbabwe.
Bangladesh lost the one-off Test and then a five-match one-day series 3-2 in Zimbabwe.
Shakib and Tamim are the best Bangladeshi cricketers to have emerged on the international scene, winning Wisden cricket magazine s international player of the year in 2009 and 2010, respectively.
But they were accused of indiscipline during the Zimbabwe tour.