I have a mono application (on Ubuntu) that tails /var/log/messages and picks up USB insertions, and if that device is on a certain port, needs to partition, format, and mount it. Obviously this requires root permissions. I'm new to Linux, and I'm wondering what the "correct" way is accomplish this.
Is it better to run my application as root all the time? Or is it better (or possible) to give my application permissions to unmount, parted, mkfs, and mount and any other root-only process I need?
Background:
Once mounted, some specific customer requested files will be loaded to the drive. Each drive is unique, so cloning will not work, and I will be supporting hundreds of drives per week, so I need it to be as automated as possible. I realize this is dangerous, so yes, I will put a warning on the machine that all drives will be formatted. I'm using mono because it fits nicely with the larger application which is written in C# .net.