Legionella effector LtpM is found to recognize short two-residue sequons, enabling site-specific O-glucosylation with minimal perturbations to a target protein, and is used to show that O-glucose can act as a constitutively active O-linked N-acetylglucosamine mimic.