The quote that you are asking about comes from Henry David Thoreau’s Civil Disobedience. The main thrust of the quote is the idea that government should not intervene in the lives of its citizens any more than is absolutely necessary. In Thoreau’s time, the government did not get very involved in people’s lives, particularly not when compared to what government does today. However, Thoreau was unhappy with the government nonetheless.
The idea that government should stay out of our lives can be traced back as far as the Declaration of Independence. There, Jefferson argues that the only reason to have a government is to protect our inalienable rights to life, liberty, and the pursuit of happiness. We form governments to protect those rights, not to have the government interfere with other aspects of our lives. Thoreau is saying that good governments do only what is necessary. They protect us from murder and from theft (among other things) but they do not unnecessarily get involved in our lives. When a government makes many laws that are not directly connected to our safety and security, it is moving away from being the best kind of government.
When Thoreau was writing in the 1840s (I’m not sure why you ask about 1817 as Thoreau was writing over 30 years later), the government was not very intrusive. There were very few of the laws that we are now used to. The government did not even do such obvious (to use today) things such as providing public schools or preventing people from polluting public waterways. Even so, Thoreau was unhappy with the US government. He was unhappy with it because of slavery and the war with Mexico. He felt that the US government was irretrievably corrupt because it allowed slavery. Because he was so disillusioned with the government, he was skeptical about the possibility of good government in general. He felt that governments would always do more harm to their people than good.
What Thoreau is saying, then, is that government should stay out of people’s lives as much as possible. The best government is the one that intervenes least in people’s lives.