Running resource manager as non-root

OS: QNX 6.3.2 on x86.

I am successful in running resource manager as non-root.

  1. Compile the res mgr code as normal user
  2. Do a chown root:root on this executable as root
  3. Do a chmod a+s on this executable as root
  4. Now you can run this res mgr as a non-root
    For doing the above steps, I have written a small program which will be run as root by a normal user. Sample program is attached.

It works fine for stand alone resource managers but doesn’t run cleanly for the resource managers that are dependant on user defined libraries.

This I am able to overcome by putting the user defined library under /lib or /usr/lib directories.

My requirement is to put the library in predefined path say /usr_lib on which everyone is given write access and then run their resource manager.

I tried all possible things that I could but failed to do so. Actually, in Linux there is file under /etc/ where we can put our extra library paths. But such kind of a thing is not present in QNX.

Any help in this regard is greatly appreciated.

Just add the library path to the LD_LIBRARY_PATH environment variable. Note that /usr/local/lib and /opt/lib are I believe already in LD_LIBRARY_PATH nice place to put your lib.

I believe programs that are setuid only access _CS_LIBPATH

I think qarry is right. If I modify LD_LIBRARY_PATH, it doesn’t refer and it fails to load. I modified _CS_LIBPATH in rc.local and everything is working as expected. Thanks for the help.

Just a note that if one of the libs in _CS_LIBPATH is world writable, this is a HUGE security hole… that’s exactly why LD_LIBRARY_PATH is ignored for suid root executables…