Multiple articles about the New Hampshire militia state that it was disbanded in 1849 so Samuel B would have obtained the rank of Major by the time he was 31 years old. He would have been about 45 at the start of the civil war and it appears he did not serve in the military however he had been and continued to serve as a Conway town selectman or a town representative before and during the civil war.
From Georgia's book which was published in 1889:
where Frederick Hayes lives, on the west side of Saco. In 1870 he moved to Conway village to become vice-president of Conway Savings Bank, of which he was an incorporator. He was treasurer and president of the bank later. By his first wife, a Hale, he had three children: Onslow, Charles B., Martha S. (Mrs. Richard Thom). His second wife was Lydia Pendexter. Of their children, Lucy (Mrs. F. W. Davis) is the only one living. His title of major was won in the state militia. He was a man of fine presence and address, large and symmetrical." He died in 1881 at midnight in Chelsea, Mass., and his son Charles at six o'clock the next morning in Dover.
Notes:
We believe that Samuel was born in Barrington, not Canaan. This is based on his death record which lists Barrington as his place of birth and the fact that his father moved to Barrington before 1810 and remained there his whole life.
Samuel's first wife was Martha Susan Leighton Hale (1816-1845), the daughter of Dea James Drew Hale and Mary H Leighton. He had a second daughter with Lydia -- Mary Alice Shackford (1857-1874).
References:
"MARRIED.," Dover Gazette & Strafford Advertiser (Dover, New Hampshire), 25 April 1837; digital image, Godfred Memorial (http://godfred.org : accessed 20 August 2013), 19th Century U. S. Newspapers.
Massachusetts, Massachusetts, Deaths, 1841-1915, , Saml B Shackford, 1 January 1881; digital images, Family Search (http://familysearch.org : accessed 10 August 2013).
Merrill Georgia Drew, Editor, History of Carroll County (Boston, Mass: W. A. Fergusson & Co, 1889), page 854; digital images, Google Books (http://books.google.com : accessed 31 August 2014.