chmod g+w on directory causes script not to execute anymore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am experiencing the strangest problem. Performing 
`chmod g+w` on a directory causes a script inside it 
not to execute anymore. I'm lost.

The reason I am mailing to the ext3 list is
I use ext3 on the partition where the problem arise.
And that I have concluded that it probably is the
ext3 file system that give this unusual behaviour....

But I am an error prone person so... it might be
something else causing this.

Glad if any of you file system experts could direct
me further. Thanks a lot.
Anyways, here it goes:


9:43:03 markus ~>echo $USER 
markus 
9:43:31 markus ~>pwd 
/home/markus 
9:43:34 markus ~>l | grep test 
drwxr-xr-x 2 root users 4096 May 29 20:44 test/ 
9:43:37 markus ~>cd test/ 
9:43:47 markus ~/test>l 
total 4 
-rwxr-xr-x 1 root root 24 May 29 20:44 myTest* 
9:43:50 markus ~/test>cat myTest 
#!/bin/sh 
echo testing 

9:43:53 markus ~/test>./myTest 
testing 
9:43:55 markus ~/test> 


So we see that the script is working. I then perform
the change logged in as root in another terminal. 

9:43:14 root ~markus>echo $USER 
root 
9:44:19 root ~markus>chmod g+w test/ 
9:44:25 root ~markus>which chmod 
/bin/chmod 
9:44:27 root ~markus> 


Then I continue in the first terminal as user markus: 

9:44:07 markus ~/test>echo $USER 
markus 
9:44:40 markus ~/test>l .. | grep test 
drwxrwxr-x 2 root users 4096 May 29 20:44 test/ 
9:44:49 markus ~/test>l 
total 4 
-rwxr-xr-x 1 root root 24 May 29 20:44 myTest* 
9:44:52 markus ~/test>./myTest 
./myTest: Permission denied. 
9:45:06 markus ~/test> 


I tried to change the contents of the script to using 
#!/bin/tcsh instead, but no result. 

I might add that the user root has no problem 
executing the script: 

9:51:21 root ~markus/test>echo $USER 
root 
9:51:22 root ~markus/test>l .. | grep test 
drwxrwxr-x 2 root users 4096 May 30 09:50 test/ 
9:51:25 root ~markus/test>l 
total 4 
-rwxr-xr-x 1 root root 24 May 30 09:50 myTest* 
9:51:28 root ~markus/test>./myTest 
testing 
9:51:34 root ~markus/test> 



The user markus is in the group users. So I thought 
the script might execute if I removed the user from 
that group with the command: 

usermod -G markus,adm,wheel,rpm,xgrp,ntools,ctools markus 

But when I try again: 

9:56:42 markus ~/test>echo $USER 
markus 
9:56:44 markus ~/test>groups 
markus adm wheel rpm xgrp ntools ctools 
9:56:46 markus ~/test>l .. | grep test 
drwxrwxr-x 2 root users 4096 May 30 09:50 test/ 
9:56:51 markus ~/test>l 
total 4 
-rwxr-xr-x 1 root root 24 May 30 09:50 myTest* 
9:56:54 markus ~/test>./myTest 
./myTest: Permission denied. 
9:56:56 markus ~/test> 

Which is really strange now, because when I switch 
back the permission for the directory, the 'W' flag 
for the group permission of the directory with the 
command 

chmod g+w test/ 

that is a command that should have no effect on the 
user markus as it is not a member of the group 
users... : 

10:01:54 markus ~/test>echo $USER 
markus 
10:02:03 markus ~/test>groups 
markus adm wheel rpm xgrp ntools ctools 
10:02:07 markus ~/test>l .. | grep test 
drwxrwxr-x 2 root users 4096 May 30 09:50 test/ 
10:02:09 markus ~/test>l 
total 4 
-rwxr-xr-x 1 root root 24 May 30 09:50 myTest* 
10:02:11 markus ~/test>./myTest 
./myTest: Permission denied. 
10:02:12 markus ~/test> 

I also tried to recreate the script file by being 
really careful to not intriduce any non printable 
characters (I used vi and the keyboard, not using any 
paste operation), still the same behaviour. 

I am running Mandrake 9.1. I am not sure the problem 
lies in chmod. If it isn't, it would be the file 
system. Or it could be that something in the script 
(echo or /bin/sh) really need write access to the 
directory. But then again my last test contradicts 
that hypothesis. 

Anyways, removing the echo command from the script: 

10:09:39 markus ~/test>cat myTest 
#!/bin/sh 
#echo testing 
10:09:41 markus ~/test> 

also gives no result. 


As the filesystem is ext3 I thought there might be 
something wrong hidden, but no (if I interpret lsattr 
output correctly): 

14:14:38 markus ~>lsattr | grep test 
------------- ./test 
14:14:47 markus ~>cd test/ 
14:16:46 markus ~/test>lsattr 
------------- ./myTest 
14:16:48 markus ~/test> 



Is there a workaround? 

The contents of my /etc/fstab is: 

20:51:31 markus ~>cat /etc/fstab 
/dev/hda1 / ext3 defaults 1 1 
none /dev/pts devpts mode=0620 0 0 
/dev/hda7 /home ext3 defaults 1 2 
/dev/scd0 /mnt/cdrom auto user,iocharset=iso8859-1,codepage=850,noauto,ro,exec 
0 0 
/dev/hdd /mnt/cdrom2 auto user,iocharset=iso8859-1,codepage=850,noauto,ro,exec 
0 0 
/dev/hda8 /mnt/film ext3 defaults 1 2 
/dev/hdb1 /mnt/film2 ext3 defaults 1 2 
/dev/fd0 /mnt/floppy auto 
user,iocharset=iso8859-1,sync,codepage=850,noauto,exec 0 0 
none /proc proc defaults 0 0 
/dev/hda6 /usr ext3 defaults 1 2 
/dev/hda5 swap swap defaults 0 0 
20:51:32 markus ~> 

/Markus

Mvh,
Markus



_______________________________________________

Ext3-users@redhat.com
https://www.redhat.com/mailman/listinfo/ext3-users

[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux