[MPlayer-users] gmplayer and SUID

Juan C. Gallardo jgamo at cantv.net
Mon Jul 21 09:30:53 CEST 2003


To be able to use mplayer fullscreen I had to set the SUID bit of the
program.
Once I did this mplayer works just fine for users, but gmplayer stop working
because something about the GTK and the SUID bit.
Then I found a solutions on the web saying I should do this:

"There are two solutions, the first being that you may already have such a
helper program on your machine, look for progs with helper or wrapper in
their names. If that doesn't work it is easy to knock one up like so;

Create a file bypassgtk.c with the following innards:

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>

int main(int argc , char **argv) {
	extern char **environ;
	if  (setuid((uid_t)0) == 0){
		printf("Executing mplayer ....\n");
		if (execve("/usr/local/bin/mplayer",argv,environ) != 0);
		perror("Can't exec mplayer");
	}
	printf("Exec mplayer failed\n");
	return 1;
}

Then save it and compile it with "gcc -o gmplayer bypassgtk.c", remove the
link /usr/local/bin/gmplayer and replace it with the new gmplayer you just
compiled. Lastly you need to (as root) "chmod u+s /usr/local/bin/gmplayer".
Obviously you need to replace /usr/local/bin with the correct path if it is
different -- especially in the code above ! "

But even if I have tried to do this a couple of times, afraid of a mistake,
still doesn't work.
Someone have a different idea, or knows where Is the mistake?

Thanks.

Juan C. Gallardo



More information about the MPlayer-users mailing list