Running a shell script in an NFS-mounted directory

Running a shell script in an NFS-mounted directory

am 07.12.2007 17:19:35 von NewJames

I have my home directory on a machine A NFS-mounted at a some
mount point in my home directory on a machine B. I have the same username
and user ID in both machines; that is, for all practical purposes the
remote home directory looks just like a subdirectory in B.

Well, not quit. If I try to run a shell script (call it S) that
lives in my home directory in A, while I am logged in at B, I get the
following error:

-bash: ./S: /bin/sh: bad interpreter: Permission denied

Why? Running S from A itself works fine, and it does not contain or
invoke anything not available under B.

Re: Running a shell script in an NFS-mounted directory

am 07.12.2007 17:24:54 von Glenn Jackman

At 2007-12-07 11:19AM, "James H. Newman" wrote:
> -bash: ./S: /bin/sh: bad interpreter: Permission denied

Does the #! line contain a (hidden) trailing carriage return?

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

Re: Running a shell script in an NFS-mounted directory

am 07.12.2007 18:15:25 von NewJames

On Fri, 07 Dec 2007 16:24:54 +0000, Glenn Jackman wrote:

> At 2007-12-07 11:19AM, "James H. Newman" wrote:
>> -bash: ./S: /bin/sh: bad interpreter: Permission denied
>
> Does the #! line contain a (hidden) trailing carriage return?

Well, this happens for all shell scripts. I have just created a
silly one that reads as follows:

#! /bin/sh

ls -l

I get the error message above when attempting to execute it from the box
that NFS-mounts the directory that contains this shell script.

Re: Running a shell script in an NFS-mounted directory

am 07.12.2007 19:31:02 von Glenn Jackman

At 2007-12-07 12:15PM, "James H. Newman" wrote:
> On Fri, 07 Dec 2007 16:24:54 +0000, Glenn Jackman wrote:
>
> > At 2007-12-07 11:19AM, "James H. Newman" wrote:
> >> -bash: ./S: /bin/sh: bad interpreter: Permission denied
> >
> > Does the #! line contain a (hidden) trailing carriage return?
>
> Well, this happens for all shell scripts. I have just created a
> silly one that reads as follows:
>
> #! /bin/sh
>
> ls -l
>
> I get the error message above when attempting to execute it from the box
> that NFS-mounts the directory that contains this shell script.

What editor do you use?

Try: od -c filename
What do you see after "/bin/sh" ?

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

Re: Running a shell script in an NFS-mounted directory

am 07.12.2007 19:58:17 von NewJames

On Fri, 07 Dec 2007 18:31:02 +0000, Glenn Jackman wrote:

> At 2007-12-07 12:15PM, "James H. Newman" wrote:
>> On Fri, 07 Dec 2007 16:24:54 +0000, Glenn Jackman wrote:
>>
>> > At 2007-12-07 11:19AM, "James H. Newman" wrote:
>> >> -bash: ./S: /bin/sh: bad interpreter: Permission denied
>> >
>> > Does the #! line contain a (hidden) trailing carriage return?
>>
>> Well, this happens for all shell scripts. I have just created a
>> silly one that reads as follows:
>>
>> #! /bin/sh
>>
>> ls -l
>>
>> I get the error message above when attempting to execute it from the
>> box that NFS-mounts the directory that contains this shell script.
>
> What editor do you use?

vi. Actually, the elvis variation that ships with Slackware 12.

> Try: od -c filename
> What do you see after "/bin/sh" ?

This is what I get:

0000000 # ! / b i n / s h \n \n l s -
0000020 l \n \n

If I understand it correctly, that second \n after #! /bin/sh is
just a blank line.

Re: Running a shell script in an NFS-mounted directory

am 07.12.2007 21:09:54 von Glenn Jackman

At 2007-12-07 01:58PM, "James H. Newman" wrote:
> On Fri, 07 Dec 2007 18:31:02 +0000, Glenn Jackman wrote:
>
> > At 2007-12-07 12:15PM, "James H. Newman" wrote:
> >> On Fri, 07 Dec 2007 16:24:54 +0000, Glenn Jackman wrote:
> >>
> >> > At 2007-12-07 11:19AM, "James H. Newman" wrote:
> >> >> -bash: ./S: /bin/sh: bad interpreter: Permission denied
> >> >
> >> > Does the #! line contain a (hidden) trailing carriage return?
> >>
> >> Well, this happens for all shell scripts. I have just created a
> >> silly one that reads as follows:
> >>
> >> #! /bin/sh
> >>
> >> ls -l
> >>
> >> I get the error message above when attempting to execute it from the
> >> box that NFS-mounts the directory that contains this shell script.
> >
> > What editor do you use?
>
> vi. Actually, the elvis variation that ships with Slackware 12.
>
> > Try: od -c filename
> > What do you see after "/bin/sh" ?
>
> This is what I get:
>
> 0000000 # ! / b i n / s h \n \n l s -
> 0000020 l \n \n
>
> If I understand it correctly, that second \n after #! /bin/sh is
> just a blank line.

Yeah, that look correct.

does /bin/sh exist on the "faulty" machine? Is it executable by you?

Next, check the mount parameters, but here you're beyond my competence.


--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

Re: Running a shell script in an NFS-mounted directory

am 07.12.2007 22:21:23 von NewJames

On Fri, 07 Dec 2007 20:09:54 +0000, Glenn Jackman wrote:

> At 2007-12-07 01:58PM, "James H. Newman" wrote:
>> On Fri, 07 Dec 2007 18:31:02 +0000, Glenn Jackman wrote:
>>
>> > At 2007-12-07 12:15PM, "James H. Newman" wrote:
>> >> On Fri, 07 Dec 2007 16:24:54 +0000, Glenn Jackman wrote:
>> >>
>> >> > At 2007-12-07 11:19AM, "James H. Newman" wrote:
>> >> >> -bash: ./S: /bin/sh: bad interpreter: Permission denied
>> >> >
>> >> > Does the #! line contain a (hidden) trailing carriage return?
>> >>
>> >> Well, this happens for all shell scripts. I have just created a
>> >> silly one that reads as follows:
>> >>
>> >> #! /bin/sh
>> >>
>> >> ls -l
>> >>
>> >> I get the error message above when attempting to execute it from
>> >> the box that NFS-mounts the directory that contains this shell
>> >> script.
>> >
>> > What editor do you use?
>>
>> vi. Actually, the elvis variation that ships with Slackware 12.
>>
>> > Try: od -c filename
>> > What do you see after "/bin/sh" ?
>>
>> This is what I get:
>>
>> 0000000 # ! / b i n / s h \n \n l s
>> - 0000020 l \n \n
>>
>> If I understand it correctly, that second \n after #! /bin/sh is
>> just a blank line.
>
> Yeah, that look correct.
>
> does /bin/sh exist on the "faulty" machine? Is it executable by you?

Yes and yes.

> Next, check the mount parameters, but here you're beyond my competence.

Thanks for your feedback anyway.