Article View: mod.std.unix
Article #189Re: Clearing environment on exec of setuid process
From: Moderator, John Quarterman
Date: Tue, 11 Feb 1986 16:09
Date: Tue, 11 Feb 1986 16:09
63 lines
2945 bytes
2945 bytes
>From: Kay Dekker <seismo!mcvax!warwick!kay>
To: ut-sally!std-unix
Organization: Computer Science, Warwick University, UK
Date: Sat, 8 Feb 86 10:20:38 GMT
>Date: Wed, 5 Feb 86 08:12:33 pst
>>From: seismo!sun!rtech!daveb (Dave Brower)
>Organization: Relational Technology Inc, Alameda CA
>
>The answer is only to do limited operations when in setuid. The best
>way to do this would be to allow processes to painlessly shift back and
>forth between their real-uid and effective-uid. This is allowed, but
>not documented on BSD, but appears not to be allowed at all on SV.
>This way, you can have your one section that need to run setuid be setuid
>whenver needed, while running as the real user the reset of the time.
This is *exactly* what I found myself needing to do last night... When
you say "BSD", does this include 4.1? If so, how do I do it? and why
isn't it documented?
Kay.
--
Virtue is its own punishment.
... mcvax!ukc!warwick!kay
[ It was introduced in 4.2BSD. Here's the man page.
Note that only super-user can actually switch back and forth
between ruid and euid. -mod ]
SETREUID(2) UNIX Programmer's Manual SETREUID(2)
NAME
setreuid - set real and effective user ID's
SYNOPSIS
setreuid(ruid, euid)
int ruid, euid;
DESCRIPTION
The real and effective user ID's of the current process are
set according to the arguments. If _r_u_i_d or _e_u_i_d is -1, the
current uid is filled in by the system. Only the super-user
may modify the real uid of a process. Users other than the
super-user may change the effective uid of a process only to
the real uid.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and _e_r_r_n_o is set to indi-
cate the error.
ERRORS
[EPERM] The current process is not the super-user and
a change other than changing the effective
user-id to the real user-id was specified.
SEE ALSO
getuid(2), setregid(2), setuid(3)
Printed 2/11/86 12 February 1983 1
Volume-Number: Volume 5, Number 44
Technical Details
Message-ID:
<4162@ut-sally.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!decvax!decwrl!pyramid!ut-sally!std-unixReferences:
<4128@ut-sally.UUCP> <4106@ut-sally.UUCP> <4029@ut-sally.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ut-sally.UUCP Path: arc1-ca.pugleaf.net!utzoo!decvax!decwrl!pyramid!ut-sally!std-unix From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) Newsgroups: mod.std.unix Subject: Re: Clearing environment on exec of setuid process Message-ID: <4162@ut-sally.UUCP> Date: Tue, 11-Feb-86 11:09:24 EST Article-I.D.: ut-sally.4162 Posted: Tue Feb 11 11:09:24 1986 Date-Received: Wed, 12-Feb-86 02:35:26 EST References: <4128@ut-sally.UUCP> <4106@ut-sally.UUCP> <4029@ut-sally.UUCP> Organization: IEEE/P1003 Portable Operating System Environment Committee Lines: 63 Approved: jsq@sally.UUCP