Sorry to bug the list with yet another programming problem but ... What permissions on the file do I need to change to allow an ordinary user to run a setuid-root programme ? The programme below compiles and runs if I compile & run as root but does not work if run by a user regardless of who compiles it. What am I doing wrong ?
<start C code> #include <stdio.h> #include <unistd.h> #include <vga.h> int main(void) { int x; x = getuid(); printf("User ID = %d\n",x); setuid(0); x = getuid(); printf("User ID = %d\n",x); setuid(1000); x = getuid(); printf("User ID = %d\n",x); return (0); } <end C code> compile as #:gcc -O2 uid.c -lvga When run as root output is : User ID = 0 User ID = 0 User ID = 1000 When run as user ivan output is : User ID = 1000 User ID = 1000 User ID = 1000 Any and all help appreciated. Ivan.