*BSD News Article 74329


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.dacom.co.kr!usenet.seri.re.kr!news.cais.net!rtd.com!dgy
From: dgy@rtd.com (Don Yuniskis)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Running a startup task as a user...
Date: 21 Jul 1996 03:08:35 GMT
Organization: CICDO
Lines: 39
Message-ID: <4ss6vj$5a5@baygull.rtd.com>
References: <31F17A39.55F@www.play-hookey.com>
NNTP-Posting-Host: seagull.rtd.com

In article <31F17A39.55F@www.play-hookey.com>,
Ken Bigelow  <kbigelow@www.play-hookey.com> wrote:
>The subject line basically says it. My daughter is setting up a MUX on my 
>auxiliary server, which needs to run under her username, not as root. I 
>can start the program in /etc/rc.local, but then some essential 
>initialization files are owned by root:wheel and cannot be accessed they 
>way they need to be.
>
>I have a clumsy solution in the form of a shell script which I run from 
>rc.local:
>
>#! /bin/sh
>#  Start the IsolationMUX
>#
>cd /usr/home/midnight/isolation/game
>./Startmux
>muxpid=`ps ax |grep Startmux |grep -v grep |awk '{print $1}'`
>if [ "X${muxpid}" != "X" ] ; then
>	wait ${muxpid}
>fi
>chown midnight:midnight *
>chown midnight:midnight data/*
>
>This works, by the BFMI (Brute Force, Massive Ignorance) method. However, 
>I would much rather have the Startmux script be run at system startup 
>under the username of midnight, so the files will automatically have the 
>right ownership assigned to them.
>
>I've looked through the Handbook and everything else I could think of, 
>but found no way to accomplish this. At the same time, I know that qpop 
>works by masquerading as the specific user it accepts mail for, so it can 
>put the mail in that user's "me-only" mail file. Can I do the same during 
>reboot, to start the MUX?

Why not create a script and install it setuid(midnight) to do the work?
Then, have rc.local invoke it (or, your daughter's .login??)  Or, am I
missing something...?

--don