Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Nov 2001 10:56:01 +0200
From:      Giorgos Keramidas <charon@labs.gr>
To:        Jim Conner <jconner@enterit.com>
Cc:        Haroon Khan <haroonca@home.com>, freebsd-questions@FreeBSD.ORG
Subject:   Re: unix question
Message-ID:  <20011113085600.GB27463@hades.hell.gr>
In-Reply-To: <5.1.0.14.0.20011112190512.02fa2d80@mail.enterit.com>
References:  <000801c16beb$d54a7dc0$d9c89d18@mtki1.on.home.com> <5.1.0.14.0.20011112190512.02fa2d80@mail.enterit.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jim Conner <jconner@enterit.com> 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




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