From: David Tolpin <dvd@davidashen.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Novice question - run as other
Date: Wed, 17 Mar 2004 11:18:12 +0400 [thread overview]
Message-ID: <200403170718.i2H7ICJm083368@adat.davidashen.net> (raw)
In-Reply-To: <5697eeee83e079696212a62a1122c1f9@9netics.com>
> > a program from a shell script and change the user it runs as.
>
> The security model doesn't allow this. Perhaps by running it as a service
> on a cpu. Check /sys/src/cmd/auth/cron.c and cap(3). For somethings
> you can cpu over and change to a different uid:
The following works:
cpu% cat > test.c
#include <u.h>
#include <libc.h>
void main(int argc,char **argv) {
int fd = open("#c/user",OWRITE);
if(argc==1) exits("argument required");
fd>=0 && (write(fd,"none",strlen("none"))!=-1)
|| (exits("cannot become none"),1);
close(fd);
exec(argv[1], argv+1);
}
^D
cpu% 8c test.c
cpu% 8l test.8
cpu% 8.out /bin/rc -c 'while () {}'
In another window
cpu% ps -a|grep 8.out
none 4546 0:15 0:00 244K Ready /bin/rc -c 'while () {}'
How can I do this without the code in C?
David
next prev parent reply other threads:[~2004-03-17 7:18 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200403161953.i2GJrNMv080779@adat.davidashen.net>
2004-03-16 22:54 ` 9nut
2004-03-17 7:18 ` David Tolpin [this message]
2004-03-17 8:10 ` Geoff Collyer
2004-03-17 8:24 ` David Tolpin
2004-03-17 8:55 ` Geoff Collyer
2004-03-17 9:04 ` David Tolpin
2004-03-17 9:19 ` Bruce Ellis
2004-03-17 10:31 ` boyd, rounin
2004-03-17 14:01 ` Dave Lukes
2004-03-17 16:22 ` [9fans] insularity rog
2004-03-17 16:32 ` Aharon Robbins
2004-03-17 16:36 ` suspect
2004-03-17 16:48 ` lucio
2004-03-17 18:09 ` Dave Lukes
2004-03-17 19:26 ` Fco.J.Ballesteros
2004-03-18 13:50 ` Dave Lukes
2004-03-17 22:48 ` Geoff Collyer
2004-03-17 23:11 ` David Presotto
2004-03-18 7:47 ` boyd, rounin
2004-03-18 2:45 ` boyd, rounin
2004-03-17 17:53 ` Dave Lukes
2004-03-17 19:12 ` Latchesar Ionkov
2004-03-17 18:56 ` vdharani
2004-03-18 2:39 ` boyd, rounin
2004-03-17 9:33 ` [9fans] Novice question - run as other 9nut
2004-03-17 8:54 ` David Tolpin
2004-03-17 8:56 ` Charles Forsyth
2004-03-17 9:07 ` David Tolpin
2004-03-17 9:17 ` Charles Forsyth
2004-03-17 9:28 ` David Tolpin
2004-03-17 10:08 ` 9nut
2004-03-17 12:43 David Presotto
2004-03-17 17:03 ` ron minnich
2004-03-17 17:13 ` rog
2004-03-17 17:13 ` David Presotto
2004-03-17 18:00 ` David Tolpin
2004-03-17 18:12 ` ron minnich
2004-03-17 18:14 ` David Presotto
2004-03-17 19:34 ` rog
2004-03-17 19:52 ` Russ Cox
2004-03-17 19:58 ` rog
2004-03-18 4:21 ` Martin C.Atkins
[not found] <200403170948.i2H9mi3W084127@adat.davidashen.net>
2004-03-17 18:24 ` 9nut
2004-03-18 7:38 ` boyd, rounin
2004-03-17 18:29 plan9fans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200403170718.i2H7ICJm083368@adat.davidashen.net \
--to=dvd@davidashen.net \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).