Thursday, March 01, 2007

setuid wrapper

I needed to run a script with root privileges,but had
forgotten that Solaris (and I guess mosts versions of Unix) will not allow setuid on scripts. The solutions is to write a binary wrapper will will call the script:


#include <unistd.h>
#include <stdio.h>

#define myfile "/path/to/script"

main(argc, argv)
char **argv;
{
setuid(0);
seteuid(0);
execv(myfile, argv);
}


Wednesday, January 17, 2007

Fix for acroread

Adobe reader fails to start on the Gnome desktop on Fedora 6. There 
seems to be a conflict withscim (smart common input method). 
The fix is to add the following to the top of /usr/bin/acroread:

export GTK_IM_MODULE=xim