Those affected include Kazakhstan's embassies in the US and Russia, India's embassy in the US and Russia's embassy in Sweden.
The information also includes Indian and Russian log-in details for email accounts at the UK visa office in Nepal, the foreign ministry of Iran and 40 Uzbeki embassies around the world.
"I did an experiment and came across the information by accident," Egerstad told Computer Sweden.
The security consultant claimed that he had not accessed any of the compromised accounts because he did not want to break the law.
However, he defended his decision to post the information online rather than warning the affected parties.
"When something like this happens you usually contact people and ask them to fix it, but in this case it felt too big for that, calling to other countries," Egerstad said.
"I hope this makes them take action. Hopefully faster than ever before, and I hope they become a bit more aware of security issues."
Graham Cluley, senior technology consultant at Sophos, said that it was highly embarrassing for the governments and embassies concerned that details of how to log-in to their email accounts had been uncovered.
"It is unclear at the moment as to how this information leaked out, but it is quite possible that human error is to blame," Cluley told vnunet.com.
"An organisation's security is only as strong as its weakest link, and people make mistakes."
Cluley added that common mistakes include choosing easily guessable passwords, using the same password for every website, or not changing a password on a regular basis.