From owner-freebsd-questions  Wed Jul 31 14:20:31 2002
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 03C3237B400
	for <freebsd-questions@freebsd.org>; Wed, 31 Jul 2002 14:20:29 -0700 (PDT)
Received: from post.webmailer.de (natwar.webmailer.de [192.67.198.70])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C40FA43E3B
	for <freebsd-questions@freebsd.org>; Wed, 31 Jul 2002 14:20:27 -0700 (PDT)
	(envelope-from smazerski@yahoo.co.jp)
Received: from ianb.local (pD9517B67.dip.t-dialin.net [217.81.123.103])
	by post.webmailer.de (8.9.3/8.8.7) with ESMTP id XAA11254;
	Wed, 31 Jul 2002 23:20:19 +0200 (MEST)
Content-Type: text/plain;
  charset="iso-8859-1"
From: Steve Mazerski <smazerski@yahoo.co.jp>
To: Alex Drummond <alex@abingdon74.freeserve.co.uk>,
	freebsd-questions@freebsd.org
Subject: Re: write a script to get root permission
Date: Wed, 31 Jul 2002 23:21:52 +0200
X-Mailer: KMail [version 1.4]
References: <020e01c238d6$41ce6f80$5d7e880a@zoomtown.com> <200208012156.06758.alex@abingdon74.freeserve.co.uk>
In-Reply-To: <200208012156.06758.alex@abingdon74.freeserve.co.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Message-Id: <200207312321.52190.smazerski@yahoo.co.jp>
Sender: owner-freebsd-questions@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-questions.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-questions>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-questions>
X-Loop: FreeBSD.ORG

On Thursday 01 August 2002 23:56, Alex Drummond wrote:
> On Wednesday 31 July 2002 9:07 pm, Phil Gates wrote:
> > Thanks everybody on ftp only login all your suggestions worked. I hav=
e
> > another problem and I know .  The person that I am working for want m=
e to
> > write a script in ksh to do some root commands and thenexit.  Is ther=
e a
> > way to get root permission in a script.
> >
> > Thanks
> >
> > Phil
>
> You have to make the script setuid root. i.e.
>         chown root scriptfile
>         chmod u+sx scriptfile

Wouldn`t that be

chmod g+sx scriptfile ? But...

> Then the script will run as root (of course you have to run the command=
s
> above as root). Writing a setuid shell script is a potential security r=
isk,
> of course.

=2E..hmm, script files aren't actually executed per-se, the interpreter (=
shell
or whatever) opens the file, reads it and executes each command
with the interpreter's user's permissions.=20


S.Mazerski


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message