in reply to Running process as another user

Looking at perlvar for $< and $>, it suggests that you may want to call POSIX::setuid() to set both in one call. Would that work for you? Or would simply setting both, $< and $> work for you, too?

($<,$>)= ($run_as, $run_as);
or
use POSIX qw(setuid); setuid( $run_as );

Replies are listed 'Best First'.
Re^2: Running process as another user
by morgon (Priest) on May 14, 2014 at 09:51 UTC
    I actually mentioned in my post why this is not what I want.

    The problem with this approach is that the resulting process (while running under the correct effective user-id) still seems to be running as root in ps.

    I would like to have a process running under another effective id and be visible as such in ps.

      Ah - I'm sorry, I thought that one was for setting the real user-id in addition to the effective user-id would have that effect.

        Actually you were right (so I am sorry).

        What I tried before I posted my question here was setting $< and that makes the process still appear as being run by root.

        But setting $> does the trick and is all that is needed.

        Seems I need to brush up on real vs effective uid...