Well Sisko did have command of the Defiant for Season 3, so we know it is possible for non-Captains to have command of ships.
Seems like I recall Picard having been Lt. Cmdr. when he had to step up in a pinch to command the Stargazer, after her captain was killed & the XO was injured, & then afterward was given command of her, & if he got a promotion, it would likely have only been to a full commander. So I just assume he too was a commander by rank when he first commander that ship
Admiral Riker has command of the Enterprise in All Good Things, as does Admiral Kirk until he got busted back to Captain, which seems a bit harsh in hindsight, because the rank of Commodore exists between admiral & captain & they too can command a ship
Then again,... Commodore Kirk just sounds kind of stupid