C programming - setuid() - Linux

This is a discussion on C programming - setuid() - Linux ; Using setuid() I can have a program run as a given user when run as a superuser. Say I want this program to run as user nobody. The problem I've run into, is that setuid expects an integer and for ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: C programming - setuid()

  1. C programming - setuid()

    Using setuid() I can have a program run as a given user when run as a
    superuser. Say I want this program to run as user nobody. The problem
    I've run into, is that setuid expects an integer and for example, user
    foo could, and probably does, have a different UID from system to
    system. How do I go about getting a UID by name to then pass the
    resulting UID to setuid() with C?





  2. Re: C programming - setuid()

    William Allaire writes:

    > How do I go about getting a UID by name to then
    > pass the resulting UID to setuid() with C?


    Try "man getpwnam"

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

+ Reply to Thread