Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.programmer > #8192

Re: fork with user privilegs/rights?

From Kaz Kylheku <330-706-9395@kylheku.com>
Newsgroups comp.unix.programmer
Subject Re: fork with user privilegs/rights?
Date 2016-03-18 15:10 +0000
Organization Aioe.org NNTP Server
Message-ID <20160318074549.9@kylheku.com> (permalink)
References <ncgo81$pau$1@news.albasani.net> <20160318071031.215@kylheku.com> <nch42n$1d04$1@gioia.aioe.org>

Show all headers | View raw


On 2016-03-18, spud@potato.field <spud@potato.field> wrote:
> On Fri, 18 Mar 2016 14:29:39 +0000 (UTC)
> Kaz Kylheku <330-706-9395@kylheku.com> wrote:
>>On 2016-03-18, Heinz-Mario Frühbeis <Div@Earlybite.individcore.de> wrote:
>>> Hi,
>>>
>>> AFAIK has a forked process the same user privilegs/rights from which is 
>>> forked.
>>> But is it possible to fork e.g. with/for sudo-rights, or if, again with 
>>> normal rights?
>>
>>Not in fork itself. A superuser process can fork an unprivileged child
>>by dropping privileges in the child case.
>>
>>Pseudocode:
>>
>>  pid = fork();
>>
>>  if (pid > 0) { /* child */
>>    setuid(getuid()); /* First order of business: drop privs. */
>
> Shouldn't that be seteuid(getuid()) ?

No; that's how you temporarily drop effective to real in a setuid
process.

Back to comp.unix.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

fork with user privilegs/rights? Heinz-Mario Frühbeis <Div@Earlybite.individcore.de> - 2016-03-18 12:19 +0100
  Re: fork with user privilegs/rights? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-03-18 09:55 -0400
  Re: fork with user privilegs/rights? Siri Cruise <chine.bleu@yahoo.com> - 2016-03-18 07:28 -0700
    Re: fork with user privilegs/rights? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-18 14:45 +0000
    Re: fork with user privilegs/rights? scott@slp53.sl.home (Scott Lurndal) - 2016-03-18 14:45 +0000
  Re: fork with user privilegs/rights? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-18 14:29 +0000
    Re: fork with user privilegs/rights? spud@potato.field - 2016-03-18 14:41 +0000
      Re: fork with user privilegs/rights? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-18 15:10 +0000
        Re: fork with user privilegs/rights? spud@potato.field - 2016-03-18 15:17 +0000
          Re: fork with user privilegs/rights? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-18 15:35 +0000
            Re: fork with user privilegs/rights? spud@potato.field - 2016-03-18 15:45 +0000
              Re: fork with user privilegs/rights? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-18 19:15 +0000
                Re: fork with user privilegs/rights? Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2016-03-21 14:23 +0000
      Re: fork with user privilegs/rights? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-03-18 09:19 -0600
    Re: fork with user privilegs/rights? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-03-18 09:15 -0600
  Re: fork with user privilegs/rights? Thomas Jahns <jahns@idontlikespam.dkrz.de> - 2016-03-18 17:29 +0100
    Re: fork with user privilegs/rights? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-18 21:00 +0000
      Re: fork with user privilegs/rights? Thomas Jahns <jahns@idontlikespam.dkrz.de> - 2016-03-21 11:23 +0100
        Re: fork with user privilegs/rights? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-22 16:52 +0000
  Re: fork with user privilegs/rights? gordonb.9720g@burditt.org (Gordon Burditt) - 2016-03-19 00:04 -0500

csiph-web