From owner-freebsd-questions Wed Jul 31 13:58: 2 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 65B4B37B400 for ; Wed, 31 Jul 2002 13:58:00 -0700 (PDT) Received: from cmailg3.svr.pol.co.uk (cmailg3.svr.pol.co.uk [195.92.195.173]) by mx1.FreeBSD.org (Postfix) with ESMTP id 717F543E5E for ; Wed, 31 Jul 2002 13:57:59 -0700 (PDT) (envelope-from alex@abingdon74.freeserve.co.uk) Received: from modem-728.barrelled.dialup.pol.co.uk ([62.25.142.216] helo=darkstar.freeserve.co.uk) by cmailg3.svr.pol.co.uk with esmtp (Exim 3.35 #1) id 17a0Xd-0007hM-00 for freebsd-questions@freebsd.org; Wed, 31 Jul 2002 21:57:58 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Alex Drummond To: freebsd-questions@freebsd.org Subject: Re: write a script to get root permission Date: Thu, 1 Aug 2002 21:56:06 +0000 User-Agent: KMail/1.4.2 References: <020e01c238d6$41ce6f80$5d7e880a@zoomtown.com> In-Reply-To: <020e01c238d6$41ce6f80$5d7e880a@zoomtown.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200208012156.06758.alex@abingdon74.freeserve.co.uk> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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=20 as root). Writing a setuid shell script is a potential security risk, of=20 course. This probably isn't the best place for this kind of general UNIX question= , you=20 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