From owner-freebsd-questions@FreeBSD.ORG Sat Feb 14 05:04:39 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0016B16A4CE for ; Sat, 14 Feb 2004 05:04:38 -0800 (PST) Received: from falcon.midgard.homeip.net (h201n1fls24o1048.bredband.comhem.se [212.181.162.201]) by mx1.FreeBSD.org (Postfix) with SMTP id 0151D43D1D for ; Sat, 14 Feb 2004 05:04:38 -0800 (PST) (envelope-from ertr1013@student.uu.se) Received: (qmail 99282 invoked by uid 1001); 14 Feb 2004 13:04:35 -0000 Date: Sat, 14 Feb 2004 14:04:35 +0100 From: Erik Trulsson To: Eric F Crist Message-ID: <20040214130435.GA99123@falcon.midgard.homeip.net> Mail-Followup-To: Eric F Crist , freebsd-questions@freebsd.org, Uwe Doering References: <20040214004739.GD650@keyslapper.org> <20040213200721.F67547@admin1.mdc.net> <402DE3CC.10603@geminix.org> <200402140628.38226.ecrist@adtechintegrated.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200402140628.38226.ecrist@adtechintegrated.com> User-Agent: Mutt/1.5.6i cc: Uwe Doering cc: freebsd-questions@freebsd.org Subject: Re: startup daemon as unpriviliged user X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Feb 2004 13:04:39 -0000 On Sat, Feb 14, 2004 at 06:28:29AM -0600, Eric F Crist wrote: > On Saturday 14 February 2004 03:01 am, Uwe Doering wrote: > > matthew wrote: > > > On Fri, 13 Feb 2004, Louis LeBlanc wrote: > > >>[...] > > >>So, how can I get a process to run automatically on startup for an > > >>unprivileged user? > > > > > > cd /usr/local/etc/rc.d > > > > > > make a small sh script like so: > > > > > > #!/bin/sh > > > su username -c "command" > > > > For scripts in '/usr/local/etc/rc.d' one should stick to the required > > semantics. That is, in this particular case you need to make sure that > > it only runs on startup and not a second time on shutdown. Like so: > > > > ------------------------ cut here ------------------------ > > #!/bin/sh > > > > case "$1" in > > start) > > su username -c "command" > > ;; > > stop) > > ;; > > esac > > ------------------------ cut here ------------------------ > > > > Also, keep in mind that the script's name requires a suffix of '.sh', or > > else the system won't execute it automatically. > > > > Uwe > > > I think you could also setuid for that user to the shell script. No, the setuid flag does not work for shell scripts. -- Erik Trulsson ertr1013@student.uu.se