Running a command or script as root

I'm writing an application (Progress language) that needs to:
1) load the contents of a cron table into the Progress application;
2) display this information in a human manner and allow a select group of people to update it (these people are logged in as themselves, not as root);
3) save everything back to the cron table (probably just overwrite the existing file with the newly generated one).

My questions relate to (1) and (3). The cron file is located in a directory called /var/spool/cron/crontabs/
-r-------- 1 root sys 1978 May 24 10:58 qadbatch

As you can see, only root can Read and Write to this file (and we like it this way!!).

Any ideas on how to read and overwrite this file without being root?

Notes:
A- The Progress application can run any Unix commands or scripts and retrieve their output (but it cannot run interactive commands such as 'crontab -e').

B- Users do not have access to the crontab command.

Thanks!!

R�al

No way ...

maybe you could try ...

  1. write a cron script --- running under root --- that would ...

     a. regularly copy /var/spool/cron/crontabs/qadbatch to /somedir/somefile 
     b. regularly check for changes in /somedir/somefile as compared to /var/spool/cron/crontabs/qadbatch. changes made to /somedir/somefile are incorporated into the qadbatch crontab.
    
  2. write a script that lets the users edit /somedir/somefile and logs those edits. since the possibility of mischief exists, you might want to add more security checks to the edit script --- i.e., require a random password that you give to the users, etc. --- just to be on the safe side.

OK, I found a few ways to do that but I was approaching the problem from the wrong angle.

You cannot modify the cron file owned by root, or so it says in man. You have to use the crontab command. This being established, how do I allow a user to modify another user's cron table? I first thought of sudo but it's not installed here and I would have to convince the sys-admins to do this - more problems...

Remote Shell! That is the way to go! You setup the user who owns the cron table to accept remote access from select users (create a .rhosts file in this user's home dir).

Then, those select users can rsh (remsh on certain systems) their way into the owner's crontab entry:
$ rsh <server-name> -l <cron-userid> "crontab <new-cron-file>"

Voila!

Thanks to those who replied.

R�al