i cant execute any bash script in the directory /var/www/html/cgi-bin if i copy the same bash script to the /tmp or anyother for that matter i am able to exucute it what can be the prob.
Laurenz Albe 7 November 2005 13:26:50 [ permanent link ]
vihang <vihang007@gmail.com> wrote:> i cant execute any bash script in the directory /var/www/html/cgi-bin> if i copy the same bash script to the /tmp or anyother for that matter> i am able to exucute it what can be the prob.>
On 7 Nov 2005 01:08:21 -0800, vihang <vihang007@gmail.com> wrote:> i cant execute any bash script in the directory /var/www/html/cgi-bin> if i copy the same bash script to the /tmp or anyother for that matter> i am able to exucute it what can be the prob.> Is /var/www/html/cgi-bin mounted noexec? (look in /etc/fstab)
-- Growing old isn't bad when you consider the alternatives. -- Maurice Chevalier
Laurenz Albe 7 November 2005 18:20:32 [ permanent link ]
Bill Marcum <bmarcum@iglou.com> wrote:>> i cant execute any bash script in the directory /var/www/html/cgi-bin>> if i copy the same bash script to the /tmp or anyother for that matter>> i am able to exucute it what can be the prob.>
Is /var/www/html/cgi-bin mounted noexec? (look in /etc/fstab)
This would (at least on my system) produce an error message.
Laurenz Albe 8 November 2005 14:56:19 [ permanent link ]
First of all, don't get annoyed by the aimless rantings of Peter. He expends a lot of energy on confusing people and telling himself how great he is.
vihang <vihang007@gmail.com> wrote:> i went through the output but i could not find the problem so here is> the output> ____________________________________________________________________ [...]> fstat64(1, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0> ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xfef5a68c) = -1 ENOTTY (Inappropriate ioctl for device)> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6dd6000> write(1, "hey hey\n", 8) = 8 [...]
The problem must be somewhere there. On my system, the following happens:
The first thing that is obvious is that the echo command is executed, the "hey hey" line is written to file 1 (standard output), it just fails to appear on the screen.
So what is standard output in your case?
The fstat64 call gives us the answer. On my machine, file 1 has major number 136 and minor number 2, that is /dev/pts/2, a Unix pseudo-TTY connected to my xterm.
In your case, file 1 has major 1 and minor 3, which is /dev/null.
(You can consult /usr/src/linux/Documentation/devices.txt for that info).
So somehow you have redirected standard output to /dev/null, and your output is not displayed.
Am I correct that if you './tmp >out', the file output contains the correct output`?
I cannot say more without examining your system or setup - maybe the /devNull thing rings a bell and you find out what went wrong.
first of all thanks for your reply.now that is interesting after your post i just checked the output of the script in the different directory and the result are really puzzling..
the results for "root@one[/var/www/html/cgi-bin]# strace -f ./tmp" in /var/www/html/cgi-bin directory are -------------------------------------------------------------------------------------------- fstat64(1, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xfee3e9ac) = -1 ENOTTY (Inappropriate ioctl for device) mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6dd6000 write(1, "hey hey\n", 8) = 8 _______________________________________________________
And the results for the root@one[/tmp]# strace -f ./tmp in /tmp directory are _______________________________________________________ fstat64(1, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6dd6000 write(1, "hey hey\n", 8) = 8 ______________________________________________________________
And the results for the root@one[/tmp]# strace -f ./tmp> in /tmp directory are> _______________________________________________________> fstat64(1, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
This time stdout is a regular file. You probbaly just created it.
You have written a bad script. Fix it please. It looks like you are writing to a relative path within the script. In one instance that path points to /dev/null, and in anther instance, not. That might be due to a symlink.
What I'm interested in is the open("/dev/tty" line.
Also it would be nice to know how you get to your command line: - Are you on the console, an xterm, connect via telnet or ssh?
Am I correct that you can repeat the problem at will, i.e. execute the script in /tmp and the one in /var/... in any order, and the former always works, the latter never?
If you compare the shell scripts with 'cmp <file1> <file2>', is there an output?
What version of util-linux are you using (rpm -qi util-linux|grep Version)?
I'm grasping at straws here, I admit that I have no clue why your shell script cannot open /dev/tty.
Also it would be nice to know how you get to your command line:> - Are you on the console, an xterm, connect via telnet or ssh?
it happens on the xterm as well as console
Am I correct that you can repeat the problem at will, i.e. execute> the script in /tmp and the one in /var/... in any order, and the former> always works, the latter never?
nope whichever script is created in /var/www/html doesn't show the output.
If you compare the shell scripts with 'cmp <file1> <file2>', is there> an output?
none> What version of util-linux are you using (rpm -qi util-linux|grep Version)?
root@one[/var]# rpm -qi util-linux|grep Version Version : 2.12a Vendor: Red Hat, Inc.
I'm grasping at straws here, I admit that I have no clue why your> shell script cannot open /dev/tty.
can this happen because of selinux.. i am out of options..
Also it would be nice to know how you get to your command line:> - Are you on the console, an xterm, connect via telnet or ssh?
it happens on the xterm as well as console
Am I correct that you can repeat the problem at will, i.e. execute> the script in /tmp and the one in /var/... in any order, and the former> always works, the latter never?
nope whichever script is created in /var/www/html doesn't show the output.
If you compare the shell scripts with 'cmp <file1> <file2>', is there> an output?
none> What version of util-linux are you using (rpm -qi util-linux|grep Version)?
root@one[/var]# rpm -qi util-linux|grep Version Version : 2.12a Vendor: Red Hat, Inc.
I'm grasping at straws here, I admit that I have no clue why your> shell script cannot open /dev/tty.
can this happen because of selinux.. i am out of options..
Laurenz Albe 15 November 2005 12:16:24 [ permanent link ]
vihang <vihang007@gmail.com> wrote:> nope whichever script is created in /var/www/html doesn't show the> output.>
I'm grasping at straws here, I admit that I have no clue why your>> shell script cannot open /dev/tty.>
can this happen because of selinux..> i am out of options..
Hmm. I realize now that you never said what distribution etc. you are using. So please, what distribution and version is this, and have you changed anything from the default settings? New kernel?
I have no idea about SELinux, but the FAQ suggests that you run in permissive mode (echo "0" >/selinux/enforce) and look at the "denied" messages in the log files.
Laurenz Albe wrote:> Hmm. I realize now that you never said what distribution etc. you are> using. So please, what distribution and version is this, and have you> changed anything from the default settings? New kernel?
i am using fedora core 3. with kernel 2.6.9-1.667 i haven't changed anything.
I have no idea about SELinux, but the FAQ suggests that you run in> permissive mode (echo "0" >/selinux/enforce) and look at the "denied"> messages in the log files.
The output is not displayed because of security context 'httpd_sys_script_exec_t'.
[root@beta cgi-bin]# ls --scontext * user_u:object_r:httpd_sys_script_exec_t test.bin [root@beta cgi-bin]#
For example, if the security context for myscript.sh is changed using the command chcon -c "system_u:object_r:httpd_sys_script_exec_t" myscript.sh, then the output of this script will not be displayed as well.
If you would like to report an abuse of our service, such as a spam message, please . Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .