Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2002 21:56:06 +0000
From:      Alex Drummond <alex@abingdon74.freeserve.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: write a script to get root permission
Message-ID:  <200208012156.06758.alex@abingdon74.freeserve.co.uk>
In-Reply-To: <020e01c238d6$41ce6f80$5d7e880a@zoomtown.com>
References:  <020e01c238d6$41ce6f80$5d7e880a@zoomtown.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Wednesday 31 July 2002 9:07 pm, Phil Gates wrote:
> Thanks everybody on ftp only login all your suggestions worked. I have
> another problem and I know .  The person that I am working for want me to
> write a script in ksh to do some root commands and thenexit.  Is there 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
Then the script will run as root (of course you have to run the commands above 
as root). Writing a setuid shell script is a potential security risk, of 
course.

This probably isn't the best place for this kind of general UNIX question, you 
might get better responses somewhere like the linuxquestions.org forums.

Alex

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?200208012156.06758.alex>