From owner-freebsd-questions Tue Nov 13 0:56:16 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id B879C37B405 for ; Tue, 13 Nov 2001 00:56:12 -0800 (PST) Received: from hades.hell.gr (patr530-a109.otenet.gr [212.205.215.109]) by mailsrv.otenet.gr (8.11.5/8.11.5) with ESMTP id fAD8u7205606; Tue, 13 Nov 2001 10:56:07 +0200 (EET) Received: (from charon@localhost) by hades.hell.gr (8.11.6/8.11.6) id fAD8u4t31110; Tue, 13 Nov 2001 10:56:04 +0200 (EET) (envelope-from charon@labs.gr) Date: Tue, 13 Nov 2001 10:56:01 +0200 From: Giorgos Keramidas To: Jim Conner Cc: Haroon Khan , freebsd-questions@FreeBSD.ORG Subject: Re: unix question Message-ID: <20011113085600.GB27463@hades.hell.gr> References: <000801c16beb$d54a7dc0$d9c89d18@mtki1.on.home.com> <5.1.0.14.0.20011112190512.02fa2d80@mail.enterit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.1.0.14.0.20011112190512.02fa2d80@mail.enterit.com> User-Agent: Mutt/1.3.23.1i 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 Jim Conner wrote: > At 18:35 11.12.2001 -0800, Haroon Khan wrote: > >What are two ways you can execute a shell script without > >execute acess permission. > > sh script.name is one way > can't think of another way without actually chmod'ing the script first and > then calling it on the command line. > > >Can you execute a shell script if you do not have read access permission > > yes, you can. > > And if I am answering homework questions, you better double-check my > answers. I am giving bogus answers. :) I think you need at least read-permissions to be able to run a script with 'sh script': % echo 'echo hello world' > test.sh % chmod 0 test.sh % sh test.sh test.sh: Can't open test.sh: Permission denied % rm test.sh override --------- charon/charon for test.sh? y % It makes sense, since sh(1) will try to open() the file for reading the commands it contains, and having no permission to do so will stop it from opening the file... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message