It was common in the US up to the 1960's. My dad was a conductor and one of his jobs was to lock the restroom doors just before the train rolled into a station.
This. I live up in the Sierra Nevada mountains and have had two winters where the power was out more than a week. I do have a whole house generator, but it's runtime has to be rationed to save propane.