#include #include #include #include #include #include /* ---------- Customize these four vars for your own config! ---------- */ /* */ /* They will almost certainly differ on your system from mine, and if */ /* the values are wrong this program won't work. */ #define SETI_USER 113 #define SETI_GROUP 113 #define SETI_DIR "/var/home/setiathome/setiathome-1.1.i386-unknown-freebsd3.1" #define NICE_LEVEL 20 /* ------------------- End of customization stuff --------------------- */ #define DIE(rc,msg) { fprintf(stderr,msg ": "); perror(NULL); exit(rc); } void main(void) { if (0 != chdir(SETI_DIR)) DIE(1,"chdir() failed"); if (0 != chroot(SETI_DIR)) DIE(1,"chroot() failed"); if (0 != setgid(SETI_GROUP)) DIE(1,"setgid() failed"); if (0 != setuid(SETI_USER)) DIE(1,"setuid() failed"); if (0 != setpriority(PRIO_USER,SETI_USER,NICE_LEVEL)) DIE(1,"setpriority() failed"); /* Note that you'll want to eliminate the redirection below for the first time you run the program so that you can answer setiathome's configuration questions. Then you'll want to add this redirection (or a redirection to /dev/null) back in for regular use. */ /* 15 June 1999 10:23 PST Note that we don't use '-email' anymore in the following command, since setting the chrooted environment up to be able to deliver outgoing mail, especially "outgoing" mail to local recipients, is a real pain. Thus you just have to check the console.log file if setiathome dies unexpectedly. */ if (0 != system("./setiathome >> console.log")) DIE(1,"system() failed"); }