RE: [suse-programming-e] bash script
Change to where you expect the scripts to be. I believe it must be under the same directory as the document's root.
Not necessarly. You can setup apache to execute cgi in any directory. Check out mod_cgi @ apache's website for more info.
If you are just trying to execute this in the shell then I will try not to overlap John's response. Check the permissions on the directory where the file is stored. The execute bit must be on for the user. Here is a directory I store stuff in:
drwxrwxrwx 2 jlm dev 1112 Nov 14 15:54 /home/jlm/bin
If the execute bit on the directory is not on then nothing in the directory is allowed to execute.
The directory needs to be executable in order to change to it, the directory being executable does not determine weather the files can be executed, only the files themselves. Jonathan Paul Cowherd Linux and Java Administrator Genscape, Inc. Email: jonathan.cowherd@genscape.com Office: (502) 583-3730 Mobile: (502) 314-0444
Jonathan Cowherd writes:
Change to where you expect the scripts to be. I believe it must be under the same directory as the document's root.
Not necessarly. You can setup apache to execute cgi in any directory. Check out mod_cgi @ apache's website for more info.
Yeah I wasn't sure about that one.
If you are just trying to execute this in the shell then I will try not to overlap John's response. Check the permissions on the directory where the file is stored. The execute bit must be on for the user. Here is a directory I store stuff in:
drwxrwxrwx 2 jlm dev 1112 Nov 14 15:54 /home/jlm/bin
If the execute bit on the directory is not on then nothing in the directory is allowed to execute.
The directory needs to be executable in order to change to it, the directory being executable does not determine weather the files can be executed, only the files themselves.
Yes, but the directory also needs to be executable to execute. Try creating a file in a directory that has the execute bit on then turn it off. You don't have access to the directory so you can't execute it. It is an unlikely scenario but one I have encountered before, not by my doing.
* Jesse Marlin (jlm@compgen.com) [030318 15:25]:
Yes, but the directory also needs to be executable to execute. Try creating a file in a directory that has the execute bit on then turn it off.
No, Jonathan is correct. E.g., hades:/tmp # whoami root hades:/tmp # mkdir test hades:/tmp # echo -e '#!/bin/sh\necho hello\n' > test/1 hades:/tmp # chmod +x test/1 hades:/tmp # chmod 600 test hades:/tmp # l -d test drw------- 2 root root 72 Mar 18 15:34 test/ hades:/tmp # test/1 hello -- -ckm
Christopher Mahmood writes:
* Jesse Marlin (jlm@compgen.com) [030318 15:25]:
Yes, but the directory also needs to be executable to execute. Try creating a file in a directory that has the execute bit on then turn it off.
No, Jonathan is correct. E.g.,
hades:/tmp # whoami root hades:/tmp # mkdir test hades:/tmp # echo -e '#!/bin/sh\necho hello\n' > test/1 hades:/tmp # chmod +x test/1 hades:/tmp # chmod 600 test hades:/tmp # l -d test drw------- 2 root root 72 Mar 18 15:34 test/ hades:/tmp # test/1 hello
[jlm@bass tmp]$ mkdir test [jlm@bass tmp]$ echo -e '#!/bin/sh\necho hello\n' > test/1 [jlm@bass tmp]$ chmod +x test/1 [jlm@bass tmp]$ chmod 600 test [jlm@bass tmp]$ ls -ld test drw------- 2 jlm dev 72 Mar 18 18:43 test [jlm@bass tmp]$ test/1 bash: test/1: Permission denied Seems like mixed results. Maybe its a PAM setting, or some other security setting.
participants (3)
-
Christopher Mahmood
-
Jesse Marlin
-
Jonathan Cowherd