bug-coreutils
[Top][All Lists]
Advanced

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

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


From: Markus Wahl
Subject: Re: chmod g+w on directory causes script not to execute anymore
Date: Fri, 30 May 2003 11:27:33 +0200

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

11:22:46 markus ~/test>lsattr .
------------- ./myTest
11:22:50 markus ~/test>lsattr myTest
------------- myTest
11:22:57 markus ~/test>

Mvh,
Markus

-----Original Message-----
From: "Markus Wahl" <address@hidden>
To: address@hidden
Date: Fri, 30 May 2003 10:13:59 +0200
Subject: Re: chmod g+w on directory causes script not to execute anymore

Hello. I am really thrilled to get help this quick.
Thanks a lot. I am including an expanded test run
here:


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>


Then I do the change in another terminal as user root:

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>

aslo gives no result.

So... can I blame microsoft? :)

/Markus





-----Original Message-----
From: address@hidden (Bob Proulx)
To: address@hidden
Date: Thu, 29 May 2003 22:28:06 -0600
Subject: Re: chmod g+w on directory causes script not to execute anymore

Markus Wahl wrote:
> I am experiencing the strangest problem. Performing
> `chmod g+w`on a directory causes a script inside it
> not to execute anymore.

That would be strange.  It does not make sense.

> 20:48:31 markus ~/test>echo $USER
> markus
> 20:48:32 markus ~>pwd
> /home/markus
> 20:48:34 markus ~>l | grep test
> drwxr-xr-x    2 root     users        4096 May 29 20:44 test/
> 20:48:37 markus ~>cd test/
> 20:48:38 markus ~/test>l
> total 4
> -rwxr-xr-x    1 root     root           24 May 29 20:44 myTest*
> 20:48:40 markus ~/test>cat myTest
> #!/bin/sh
> echo testing
> 
> 20:48:41 markus ~/test>./myTest
> testing

So far so good.

> 20:48:43 markus ~/test>
>
> So we see that the script is working. I then perform the change
> logged in as root. Therafter I try executing the script again
> (still as user markus):
>
> 20:50:00 markus ~/test>echo $USER
> markus
> 20:50:02 markus ~/test>l .. | grep test
> drwxrwxr-x    2 root     users        4096 May 29 20:44 test/

Looks fine.

> 20:50:12 markus ~/test>./myTest
> ./myTest: Permission denied.

But then just right at the critical point you did not include enough
information to deduce what is failing. :-( What is the permission at
this point in time of ./myTest?  It appears from the error message
that you do not have permission to run it.  Without that information
it is impossible to say what is happening.  And what was the chmod
command that you ran?

Bob


_______________________________________________
Bug-coreutils mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/bug-coreutils


Mvh,
Markus




Mvh,
Markus






reply via email to

[Prev in Thread] Current Thread [Next in Thread]