*BSD News Article 74298


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.mira.net.au!inquo!in-news.erinet.com!imci5!imci4!newsfeed.internetmci.com!hunter.premier.net!news1.erols.com!newsmaster@erols.com
From: Ken Bigelow <kbigelow@www.play-hookey.com>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Running a startup task as a user...
Date: Sat, 20 Jul 1996 17:30:49 -0700
Organization: Erols Internet Services
Lines: 39
Message-ID: <31F17A39.55F@www.play-hookey.com>
NNTP-Posting-Host: kenjb05.play-hookey.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.02 (Win16; I)

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?
-- 

Ken

Are you interested in   |
byte-sized education    |   http://www.play-hookey.com
over the Internet?      |