Bacterial flagella are driven by an ion influx through the peptidoglycan (PG)-tethered MotA/MotB stator. Stator precomplexes assemble in the membrane and remain inactive until they incorporate into the motor, upon which MotA/MotB changes conformation. The nature of this change and the mechanism of inhibition of the PG-binding and ion-conducting activities of the precomplexes are unknown. Here, the structural analysis of a series of N-terminally truncated MotB fragments is presented, the mechanism of inhibition by the linker is identified and the structural basis for the formation of the PG-binding-competent open-channel MotA/MotB conformation via a mechanism that entails linker unfolding and rotational displacement of MotB transmembrane helices is uncovered.