Simple C program to execute another program

Used if you need a simple chmod+s on a script. Compile a simple c app and then set it to chmod+s and then your script will run as the specified user.

Sample code:

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
  execl("/usr/bin/svn", "svn", "export", "http://foo.bar/", "--username", 
"dtbaker", "--password", "bar",
 "/var/www/path/to/somewhere/", "--force",  (const char *) NULL);
  return(EXIT_FAILURE);
}

Leave a Reply

Your email address will not be published. Required fields are marked *