When the right to mine is in any case separate from the ownership or right of occupancy to the surface, the owner or rightful occupant of the surface may demand satisfactory security from the miner, and if it is refused, he may enjoin such miner from working until such security is given. The order for injunction shall fix the amount of bond.