My father spent a tour of duty in the United States Marine Corps, in the 1950s. It was before the rank realignment that created the lance corporal, and it was between wars, so he spent his entire tour working in a supply warehouse in 29 Palms. Now, 29 Palms is an armpit, but it beats getting shot at for a living.What you are touching upon though are two different mechanisms: authority by rank, and authority by position. How these two interplay is best answered by someone who knows more about the military than I do.
At any rate, the individual in charge of supply put my dad in charge. So even though he never rose above corporal, he nonetheless, while on duty, had positional authority to tell people who outranked him where to go and what to do. And when he was off-duty, the opposite was true. It made for very friendly working relationships.