Basically all you want provided you take some basic precautions, and they're not locked. Which varies by origin of the train.
>don't touch any controls other than sidewall heaters, lights, and hvac.
>keep aware of passing trains and duck out of sight.
>turn the lights off and hide in the toilet if the trains stops outside a terminal or siding.
>get on and off outside the yard areas.
>trains crew really doesn't care. So long as you leave when spotted. We're going to report it. Don't be one of those meth head hobos that wants to fight and barricade inside the locomotive.
>leave no trace you were there.