On singing chanties while sitting in shanties:
Although the two words are presently spelled the same in some lexicons, Webster's seems to think they are different words.
The word for a shack is attributed to the French word chantier, a lumber camp, from a Latin root cantherius meaning a rafter or a trellis. Hence, a crude dwelling of the kind thrown up in lumber camps.
The word for a seaman's working song derives from the French word for singing, chanter.
Webster's dates the former to 1820 and the latter to 1856, but I think the singing root must go back further than that.