Home > Archive > PERL Beginners > August 2005 > Access denied
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Kris Van Bruwaene 2005-08-24, 7:55 am |
| Can anyone help me with this, I've read FAQ7 but still can't figure
out what's wrong here - I'm probably overlooking something very basic
in linux permissions. The strange thing is, scripts are running
merrily through an apache server on this machine, as long as they
reside on a smb share (on another machine). When I move the scripts to
the local machine, I get the problem illustrated below.
[~]# cat tst =20
#!/usr/bin/perl
print "Hello world\n";
[~]# ./tst
bash: ./tst: /usr/bin/perl: bad interpreter: Toegang geweigerd (=3DAccess d=
enied)
[~]# perl tst
Hello world
[~]# which perl
/usr/bin/perl
[~]# ls tst -l
-rwxrwxr-x 1 kris users 39 2005-08-23 15:27 tst
[~]# uname -a =20
Linux A00012344 2.6.7 #2 SMP Wed Jul 28 04:25:36 CEST 2004 i686 GNU/Linux
[~]# perl -V
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=3Dlinux, osvers=3D2.4.27-ti1211, archname=3Di386-linux-thread-mu=
lti
uname=3D'linux kosh 2.4.27-ti1211 #1 sun sep 19 18:17:45 est 2004
i686 gnulinux '
config_args=3D'-Dusethreads -Duselargefiles -Dccflags=3D-DDEBIAN
-Dcccdlflags=3D-fPIC -Darchname=3Di386-linux -Dprefix=3D/usr
-Dprivlib=3D/usr/share/perl/5.8 -Darchlib=3D/usr/lib/perl/5.8
-Dvendorprefix=3D/usr -Dvendorlib=3D/usr/share/perl5
-Dvendorarch=3D/usr/lib/perl5 -Dsiteprefix=3D/usr/local
-Dsitelib=3D/usr/local/share/perl/5.8.7
-Dsitearch=3D/usr/local/lib/perl/5.8.7 -Dman1dir=3D/usr/share/man/man1
-Dman3dir=3D/usr/share/man/man3 -Dsiteman1dir=3D/usr/local/man/man1
-Dsiteman3dir=3D/usr/local/man/man3 -Dman1ext=3D1 -Dman3ext=3D3perl
-Dpager=3D/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm
-Duseshrplib -Dlibperl=3Dlibperl.so.5.8.7 -Dd_dosuid -des'
hint=3Drecommended, useposix=3Dtrue, d_sigaction=3Ddefine
usethreads=3Ddefine use5005threads=3Dundef useithreads=3Ddefine
usemultiplicity=3Ddefine
useperlio=3Ddefine d_sfio=3Dundef uselargefiles=3Ddefine usesocks=3Dund=
ef
use64bitint=3Dundef use64bitall=3Dundef uselongdouble=3Dundef
usemymalloc=3Dn, bincompat5005=3Dundef
Compiler:
cc=3D'cc', ccflags =3D'-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=3D64',
optimize=3D'-O2',
cppflags=3D'-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion=3D'', gccversion=3D'3.3.6 (Debian 1:3.3.6-6)', gccosandvers=
=3D''
intsize=3D4, longsize=3D4, ptrsize=3D4, doublesize=3D8, byteorder=3D123=
4
d_longlong=3Ddefine, longlongsize=3D8, d_longdbl=3Ddefine, longdblsize=
=3D12
ivtype=3D'long', ivsize=3D4, nvtype=3D'double', nvsize=3D8, Off_t=3D'of=
f_t',
ls size=3D8
alignbytes=3D4, prototype=3Ddefine
Linker and Libraries:
ld=3D'cc', ldflags =3D' -L/usr/local/lib'
libpth=3D/usr/local/lib /lib /usr/lib
libs=3D-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
perllibs=3D-ldl -lm -lpthread -lc -lcrypt
libc=3D/lib/libc-2.3.2.so, so=3Dso, useshrplib=3Dtrue, libperl=3Dlibper=
l.so.5.8.7
gnulibc_version=3D'2.3.2'
Dynamic Linking:
dlsrc=3Ddl_dlopen.xs, dlext=3Dso, d_dlsymun=3Dundef, ccdlflags=3D'-Wl,-=
E'
cccdlflags=3D'-fPIC', lddlflags=3D'-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):=20
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Jun 8 2005 23:43:21
@INC:
/etc/perl
/usr/local/lib/perl/5.8.7
/usr/local/share/perl/5.8.7
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl
/usr/local/lib/perl/5.8.4
/usr/local/share/perl/5.8.4
| |
| Kris Van Bruwaene 2005-08-24, 6:55 pm |
| On 8/24/05, Raj, Raymond <Raymond.Raj@contractor.thomson.com> wrote:
> give execute permission to your perl script
I think it has! That's why I included:
[~]# ls tst -l
-rwxrwxr-x 1 kris users 39 2005-08-23 15:27 tst
| |
| Kris Van Bruwaene 2005-08-24, 6:55 pm |
| On 8/24/05, David Van Ginneken <davevg@gmail.com> wrote:
> [~]# perl tst
> What happens? If that works.
That works, it was included in my original posting.
>=20
> Try this:
> [~]# cat tst
> #!/usr/bin/perl -w
> print "Hello world\n";
Here goes:
[~]# cat tst
#!/usr/bin/perl -w
print "Hello world\n";
[~]# ./tst
bash: ./tst: /usr/bin/perl: bad interpreter: Toegang geweigerd
And about the carriage return: I was already familiar with that
problem (also mentioned in FAQ7). Although the scripts reside on a smb
share, they have unix-like line endings:
[~]# xxd tst
0000000: 2321 2f75 7372 2f62 696e 2f70 6572 6c20 #!/usr/bin/perl=20
0000010: 2d77 0a70 7269 6e74 2022 4865 6c6c 6f20 -w.print "Hello=20
0000020: 776f 726c 645c 6e22 3b0a world\n";.
Perhaps I should have mentioned, I'm not quite a beginner...
Problem not yet solved, but thanks
Kris
| |
| Eric Pozharski 2005-08-25, 9:55 pm |
| Kris Van Bruwaene <kris.vanbruwaene@gmail.com> wrote:
> Can anyone help me with this, I've read FAQ7 but still can't figure
> out what's wrong here - I'm probably overlooking something very basic
> in linux permissions. The strange thing is, scripts are running
> merrily through an apache server on this machine, as long as they
> reside on a smb share (on another machine). When I move the scripts to
> the local machine, I get the problem illustrated below.
>
> [~]# cat tst
> #!/usr/bin/perl
> print "Hello world\n";
>
> [~]# ./tst
> bash: ./tst: /usr/bin/perl: bad interpreter: Toegang geweigerd (=Access denied)
Actually that problem isn't related to perl itself. Executables (either
binary or scripts, no matter) are executed with execve(2) system call.
If it fails then it returns error code; among others EACCES, for
problems with permissions. (For any problem, see execve(2) for list.)
I think that (if it's in your home):
#!/bin/sh
echo "Hello, world"
wouldn't work too.
>
> [~]# perl tst
> Hello world
>
> [~]# which perl
> /usr/bin/perl
>
> [~]# ls tst -l
> -rwxrwxr-x 1 kris users 39 2005-08-23 15:27 tst
That's strange. Why GID is 'users'? Didn't you play with your home?
(Give `stat ~' output.) One more question. Your /home/ has dedicated
partition, right? Isn't it mounted with wild option, such as
`noexec'?
p.s. I noticed one more strangeness. Do you do all that as root? Is
root's home directory `/root/' or `/home/root/'. But wait, how did you
managed user 'kris' to create files in root's home?
--
Torvalds' goal for Linux is very simple: World Domination
(it's third person quote.)
| |
| Kris Van Bruwaene 2005-08-26, 6:56 pm |
| On 8/25/05, Karyn Williams <karyn@calarts.edu> wrote:
> At 11:29 AM 8/25/05 +0200, you wrote:
> Try changing your shell to /bin/sh and then try running the script from t=
he
> command line.
That won't help, my sh is a symlink to bash.[color=darkred]
>=20
Not entirely true really, it's a mount option, I just tried it like:
mount -o exec,uid=3Dkris -t vfat /dev/fd0 /floppy
and the script executes all right (with another PC, I didn't try yet
on the one with the problem).
Anyway, the partition with the "Access denied problem" is reiserfs
(v3), so that doesn't explain anything. I think I'll give up and just
reinstall Knoppix on that PC next monday, something 's definitely
screwed up. Unless you have an idea to debug it further (strace, delve
into the source of bash or anything?). I'm not a C programmer tho.
Thanks for your time.
Kris
|
|
|
|
|