Re: Only root can run the program?

Search this archive.

From: Jay Link (jlink@ilbbs.com)
Date: Sun 12 May 2002 - 19:46:32 IDT


>   I have develope a program with svgalib and compiled it as a common
> user. However, I found it can only be run as a root. Why?


Reeeally, 007...   You'll find this covered in nearly all the docs.


Real answer: chances are, you're using a 1.4.x (or earlier) version of
SVGAlib. Here's the deal: to access hardware directly (as SVGAlib does),
you must be root. The solution (with your version of SVGAlib) is to first
ensure that your program is owned by root. Next, make it "setuid root" by
doing this:

chmod u+s <program name>

This will allow non-root users to run it as though they were root. Do be
sure that it's owned by root, first, however; otherwise, all you'll end up
doing is making it "setuid yourself", which won't help anyone.

Some people think this setuid business makes SVGAlib programs insecure.
However, the first call to vga_init() drops these root privileges.

Still, some people are never happy, so Matan has created the 1.9.x series
of SVGAlib which circumvents the setuid issue entirely. (However, with
1.9.x, you *will* need to install a kernel module called "svgalib_helper",
but that's easily accomplished -- just read Matan's docs).


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST