All the MD law I've seen is focused on "transport" meaning movement by land vehicle, personal conveyance, etc. Even the hunting regulations only seem to address transporting a firearm to a boat, as for duck or goose hunting... nothing much (that I've noticed) talks about securing it once the firearm is on board a boat.
In a car or truck, unloaded, cased, and separated from the driver's immediate reach is sufficient. OTOH, there's also some wording about where you can take it: a range, a gun shop or gun show, to the hunting grounds, with no stops in between. I'm not expert, but I think that doesn't apply when you're living aboard your boat.... which is substantially larger than an open duck hunting skiff or bass boat or whatever.
I've not seen anything that addresses keeping a rifle in your home (aside from the ongoing yammering about assault weapons which according to MD shouldn't be allowed on the planet... and even there, it's not about keeping them in your home, it's about being allowed to own them in the first place.) We are not required to "secure" firearms in our home. Were it me, I would feel comfortable storing it however you wish while on board.
In the past, when I've had firearms questions, I got very good and courteous info from the State Police firearms guy. I think he was at the Glen Burnie Barrack:
Or see also https://www.mdsp.org/FAQs.aspx
(The query title is about firearms, but mostly here that's abbreviated to handguns)
They must be unloaded, in a carrying case, holster with a flap and the ammunition should be separate. It would be best to keep the unloaded weapon in the trunk where you do not have access to it. There are further regulations but essentially you can only transport a handgun between residence, to and from a repair shop, a shooting sporting event, between a residence and place of business if substantially owned and operated by the person. For more information please contact our Licensing Division
You can open that licensing division link from the firearms question on their FAQ page, and ask direct via e-mail.