You'll need a bit of liquid on the glass for the sugar to stick to. Lime juice is an obvious choice since we're already working with limes to make the cocktail, but you could also use a bit of agave syrup, simple syrup, or honey. Be sure to use just enough liquid to wet the rim or side of the glass; if the liquid is running down the side of the glass, the sugar will too.