4

We have an issue where cache and another script just ate our server away making it un-bootable. I believe Windows or Mac OS X would never allow this. After having read "Server logs are filling my hard disk, how do I fix this?" I still need a solution.

Say that a custom script is set to run as root. If that script goes berserk it could output a file that grows and grows on the server until there is no more space available. Even overwriting system files.

Is there any way to ensure that root, or any process on a system from any user, never fill the hard disk to capacity?

RingtoneP
  • 141
  • What sort of script? (bash, python, etc) N.B. Probably wrong with the Windows thing... I have operated Windows on a tiny partition, and had many issues with programs trying more space than there is available. – Wilf Aug 11 '14 at 21:35
  • You say "even overwriting system files". Could you show us some evidence? – waltinator Aug 11 '14 at 22:32
  • 1
    Root can do whatever it wants, which is the whole point of root. Run it as a different user and give privileges it needs. OSX is also Unix, which means its root user can do whatever it wants. Windows' administrator users are much less powerful. – muru Aug 12 '14 at 10:25

2 Answers2

1

A "Custom script is set to run as root" sounds risky. Are you sure it must be?

You could create another partition, and have the script write output there. Then, it will only fill that partition, and the script will fail without troubling the system.

While the script is running (running away) use lsof (See man lsof for details) to see which file(s) is/are growing, seemingly without bound. Then, fix the script.

waltinator
  • 36,399
0

You can use user "quota" to limit the amount of space a user takes on disk. Then you can run the script as that user.

Apoorv
  • 107