Executability problem
I recently discovered that scripts have become non-executable on my reiserfs share, even though the -x flags are set:
root@A00012344:/home/kris# cat tst #! /usr/bin/perl -w print "Hello world\n"; root@A00012344:/home/kris# ./tst bash: ./tst: /usr/bin/perl: bad interpreter: Toegang geweigerd #(=Access denied) root@A00012344:/home/kris# perl tst Hello world root@A00012344:/home/kris# cp tst /tmp root@A00012344:/home/kris# cd /tmp root@A00012344:/tmp# ./tst Hello world root@A00012344:/tmp# ls tst -l -rwxr-xr-x 1 root root 43 2005-08-30 15:19 tst root@A00012344:/tmp# ls /home/kris/tst -l -rwxrwxr-x 1 kris users 43 2005-08-25 11:00 /home/kris/tst root@A00012344:/tmp# file tst tst: perl script text executable root@A00012344:/tmp# file /home/kris/tst /home/kris/tst: perl script text executable
/tmp is on an ext3 share (same machine). The perl help unable to help, looks like a reiserfs problem. Some other info:
root@A00012344:/tmp# cat /etc/fstab | grep home /dev/hda3 /home reiserfs defaults,exec,user,auto 0 0
(I just added the exec and did a remount to try but it didn't help, it's not really necessary)
root@A00012344:/tmp# uname -a Linux A00012344 2.6.7 #2 SMP Wed Jul 28 04:25:36 CEST 2004 i686 GNU/Linux
Thx
Kris
*** Disclaimer ***
Deze e-mail, met eventuele bijlagen, is alleen bestemd voor de persoon of organisatie aan wie hij gericht is en, in voorkomend geval, alleen voor het daarin opgegeven doel of gebruik. Hij kan vertrouwelijke informatie bevatten en/of persoonlijke standpunten die niet noodzakelijk met die van de VRT stroken. Elk gebruik van deze informatie (zoals bewerken, doorsturen, geheel of gedeeltelijk reproduceren of verspreiden in welke vorm ook) door anderen dan de geadresseerde, is verboden. Hebt U deze e-mail per vergissing ontvangen, meld dat dan a.u.b. aan de VRT en wis de e-mail.
Kris, please linewrap after 72 chars and refrain from posting non-relevant signatures.
Kris Van Bruwaene wrote (ao):
Quoted 16 lines
I recently discovered that scripts have become non-executable on my reiserfs share, even though the -x flags are set:
root@A00012344:/home/kris# cat tst #! /usr/bin/perl -w print "Hello world\n"; root@A00012344:/home/kris# ./tst bash: ./tst: /usr/bin/perl: bad interpreter: Toegang geweigerd #(=Access denied) root@A00012344:/home/kris# perl tst Hello world root@A00012344:/home/kris# cp tst /tmp root@A00012344:/home/kris# cd /tmp root@A00012344:/tmp# ./tst Hello world root@A00012344:/tmp# ls tst -l -rwxr-xr-x 1 root root 43 2005-08-30 15:19 tst root@A00012344:/tmp# ls /home/kris/tst -l -rwxrwxr-x 1 kris users 43 2005-08-25 11:00 /home/kris/tst
Can you try:
which perl
ls -l which perl
perl -wc /home/kris/tst/home/kris/tst
and send the output?
Signature · 2 lines
Humilis IT Services and Solutions http://www.humilis.net
Quoted 6 lines · Kris Van Bruwaene
I recently discovered that scripts have become non-executable on my reiserfs share, even though the -x flags are set:
root@A00012344:/home/kris# cat tst #! /usr/bin/perl -w print "Hello world\n"; root@A00012344:/home/kris# ./tst bash: ./tst: /usr/bin/perl: bad interpreter: Toegang geweigerd #(=Access denied)
I believe the line should read
#!/usr/bin/perl -w
not
#! /usr/bin/perl -w
[no space between "!" and first "/"]
unless that's a typo between output and your file.
Signature · 3 lines
~Mike - Just my two cents - No man is an island, and no man is unable.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Kris Van Bruwaene
Both work for me, except on the reiserfs share...
I don't suppose your reiserfs share is mounted with noexec, is it?
Because that would explain the issue...
Check your fstab.
--
~Mike
- Just my two cents
- No man is an island, and no man is unable.
Quoted 8 lines · michael chang
Quoted 6 lines · Kris Van Bruwaene
I recently discovered that scripts have become non-executable on my reiserfs share, even though the -x flags are set:
root@A00012344:/home/kris# cat tst #! /usr/bin/perl -w print "Hello world\n"; root@A00012344:/home/kris# ./tst bash: ./tst: /usr/bin/perl: bad interpreter: Toegang geweigerd #(=Access denied)
Quoted 8 lines
I believe the line should read
#!/usr/bin/perl -w
not
#!/usr/bin/perl-w[no space between "!" and first "/"]
unless that's a typo between output and your file.
Actually, space between shell-bang and the path to the interpreter is perfectly legal in Linux.
Kris, what is the output of
$ cat /proc/mounts
?
Quoted 6 lines
Signature · 4 lines
-- ~Mike - Just my two cents - No man is an island, and no man is unable.
Nikita.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Kris Van Bruwaene
michael chang <[email protected]> schreef:
Quoted 5 lines · Kris Van Bruwaene
Quoted 1 line
Looks like you've hit it. How come it's noexec here and exec/defaults in
/etc/fstab??How are you mounting the filesystem? E.g. from a command line, or from an init script; as root or as a user, etc.
It usually gets mounted at boot time, I suppose by an init script (I'm using Knoppix). But I just did (as root):
Quoted 7 lines
root@A00012344:/home/kris# mount -o remount /home root@A00012344:/home/kris# cat /etc/fstab | grep home /dev/hda3 /home reiserfs defaults,exec,user,auto 0 0 root@A00012344:/home/kris# cat /etc/mtab | grep home /dev/hda3 /home reiserfs rw,noexec,nosuid,nodev 0 0...and it's still noexec!?
try
"mount -o remount,exec /home"
or
"umount /home; mount /home;"
(or both)
As for the knoppix init scripts... they're pretty restrictive. Like mounting things read only, AFAIK.
Signature · 3 lines
~Mike - Just my two cents - No man is an island, and no man is unable.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Kris Van Bruwaene
michael chang <[email protected]> schreef:
Quoted 1 line
"mount -o remount,exec /home"
Bingo:
root@A00012344:/home/kris# mount -o remount,exec /home root@A00012344:/home/kris# cat /etc/mtab | grep home /dev/hda3 /home reiserfs rw,nosuid,nodev 0 0 exit [~]# ./tst Hello world
Of course, that still doesn't answer why Knoppix is mounting a reiserfs partition as noexec even when the fstab says otherwise... unless you changed the fstab and then not reboot afterwards?
But at least that's a decent "workaround", for lack of a better wording.
Signature · 3 lines
~Mike - Just my two cents - No man is an island, and no man is unable.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 13 lines · Kris Van Bruwaene
Quoted 12 lines · michael chang
Quoted 10 lines · Kris Van Bruwaene
michael chang <[email protected]> schreef:
Quoted 2 lines
"mount -o remount,exec /home"
Bingo:
root@A00012344:/home/kris# mount -o remount,exec /home root@A00012344:/home/kris# cat /etc/mtab | grep home /dev/hda3 /home reiserfs rw,nosuid,nodev 0 0 exit [~]# ./tst Hello world
Quoted 6 lines
Quoted 4 lines
Of course, that still doesn't answer why Knoppix is mounting a reiserfs partition as noexec even when the fstab says otherwise... unless you changed the fstab and then not reboot afterwards?
Of course not. All I did was add "exec" to the /home line in fstab without rebooting, but the "defaults" was there all the time.
IIRC, options in fstab are only read on boot, unless you're a regular user mounting a partition with the "user"/"users" thingie...
Quoted 2 lines
Another thing that puzzles me is: shouldn't "mount -o remount" read fstab as well?
AFAIK, no. "umount /mountpoint;mount /mountpoint" might. Logically, you'd want to change fstab, and have the distro boot off that fstab. But then again, KNOPPIX is a live-cd -- this'd be painful. Not to mention AFAIK Knoppix autodetects partitions and creates a fstab on boot; meaning that changes usually don't survive reboots. Knoppix may have modified defaults to mount noexec by default. It might be easier to use a different distro, installed on a HD, if possible (maybe Ubuntu or Debian?).
Someone want to go verify and complain to the Knoppix people? I think the noexec thing, if enabled, is a security feature, though, and so partitions are mounted ro/noexec/etc. by default. Basically to prevent idiotism, I suppose.
Quoted 2 lines
Quoted 1 line
But at least that's a decent "workaround", for lack of a better wording.
Right. Thanks again!
No problem.
Signature · 3 lines
~Mike - Just my two cents - No man is an island, and no man is unable.