South Sudan's president has granted amnesty to armed opposition leader Riek Machar and all rebel groups days after signing a power-sharing agreement in the latest effort to end a five-year civil war.

The South Sudan Broadcasting Corporation reported the announcement by President Salva Kiir on Thursday.

The opposition under Machar, however, quickly took offence, saying Kiir was in no position to grant amnesty to anyone after overseeing the atrocities and multiple ceasefire violations committed by South Sudanese troops.

"Salva should instead seek for forgiveness from Dr. Machar in particular and South Sudanese in general," opposition spokesman Lam Paul Gabriel said.

The statement indicated that relations remained fragile between the rival sides despite the agreement that Kiir and Machar signed over the weekend in Sudan.

As part of the power-sharing deal, Kiir will remain president and Machar will return to the country as the first vice president, one of five vice presidents.

A similar agreement fell apart in July 2016 as fighting erupted and Machar fled the country.

The civil war broke out in December 2013 between supporters of Kiir and Machar, who was serving his first stint as Kiir's deputy.

The fighting, often along ethnic lines, since then has killed tens of thousands of people and created Africa's largest refugee crisis since the 1994 Rwandan genocide.

The United States last month said it was "sceptical" the two men whose rivalry has been so destructive could lead the way to peace under the new agreement.

South Sudan's government insists things will be different this time, with government spokesman Michael Makuei saying last week that Machar has "learned the hard way."

Machar's troops are expected to go to cantonment sites for training to be unified with the government army.