Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2002 23:21:52 +0200
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
Message-ID:  <200207312321.52190.smazerski@yahoo.co.jp>
In-Reply-To: <200208012156.06758.alex@abingdon74.freeserve.co.uk>
References:  <020e01c238d6$41ce6f80$5d7e880a@zoomtown.com> <200208012156.06758.alex@abingdon74.freeserve.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207312321.52190.smazerski>