Section 4. A person owning or occupying land adjoining a public way in a town may construct a sidewalk within such way and along the line of such land, indicating the width of such sidewalk by trees, posts or curbstones set at reasonable distances apart, or by a railing; and, if a sidewalk is so constructed, whoever rides or drives a horse or team upon and along the same shall forfeit one dollar, to be recovered by such owner or occupant in tort. But this section shall not affect the authority of surveyors of highways or of road commissioners, or any other authority which can legally be exercised over ways, or diminish the liability of any person for unreasonably obstructing ways, nor shall it apply to cities.