473,624 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem calling a shell script

Help please.

Setup: RH EL3, PHP 4.3.5, Apache 1.3.29 running as user "nobody".

Have a bash script named shell_script.

Telnet to server as user "nobody" ("nobody" having been given /bin/bash
as temp shell), can run this script from command line, no problems.

Created a php script including the line:
system ("/path/to/shell_script");
but get error message in apache error logs:
/bin/bash: /root/.bashrc: Permission denied

Appears that PHP is using root environment rather than "nobody" env?
phpinfo seems to list env vars for root under the "Environmen t" section.

Will compiling PHP as "nobody" instead of root solve or cause other
probs?

Geoff M
Jul 17 '05 #1
1 3005
gmuldoon wrote:
Help please.

Setup: RH EL3, PHP 4.3.5, Apache 1.3.29 running as user "nobody".

Have a bash script named shell_script.

Telnet to server as user "nobody" ("nobody" having been given /bin/bash
as temp shell), can run this script from command line, no problems.

Created a php script including the line:
system ("/path/to/shell_script");
but get error message in apache error logs:
/bin/bash: /root/.bashrc: Permission denied

Appears that PHP is using root environment rather than "nobody" env?
phpinfo seems to list env vars for root under the "Environmen t" section.

Will compiling PHP as "nobody" instead of root solve or cause other
probs?

Geoff M


You could change the permissions of /root/.bashrc to global read
therefore your script would be able to read/initialize - however I
cannot understand as to why your script would have the dependancy on
this if its being run from user 'nobody'. Try running a simple
'/bin/touch /tmp/myTestFile' from your php script and then check and see
the ownership of /tmp/myTestFile.

To make the .bashrc file read to the world, try (from root)

# chmod a+r /root/.bashrc

Depending on the contents of the .bashrc file, a hacker would be able to
read this file and potentially gain additional information on your
system, though I would gather that if they have access to your system
anyway, the .bashrc file alone is the least of your problems...

I hope something above helps... You might re-post with a cross post both
here in the PHP ng and comp.infosystem s.www.servers.unix as someone with
Apache knowledge might throw in an extra piece of info...

laters
randelld
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9938
by: John Bowling | last post by:
I'm creating a routine (not in a browser) to move multiple files on a daily basis to a backup directory. It can be done easily by call shell functions like 'mv file* newdir'. I can't find any reference in the Java tutorial about accessing or using the shell or system other than standard i/o. Does anyone have a clue on how to pass a command to the shell to execute a program? My other option is to write a shell script that calls a few...
0
2480
by: Gardner Pomper | last post by:
Hi, I am pretty new to python, so be gentle :) I have a python script that spawns a number of threads (configurable) on a 12 processor AIX RISC-6000 machine. It works fine, so long as I am running less than 5 threads. With more than 5, I get errors, but only on AIX, not on Linux. The python script is fairly simple, because each thread just spawns a korn
11
5024
by: ronan_boisard | last post by:
hi all, I'm trying to call ksh script from python. I have a file (toto.env) with a scirpt looking like: -- begin --- #!/bin/ksh # export TOTO_ENV=/home/toto -- end ---
3
19153
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application Event log. My environment: Windows Server 2003, IIS 6, WSH, Classic ASP, Vbscript Below is the code and the error: Code:
3
21469
by: Kim Forbes | last post by:
Hello all, I have simple function that I call from an alert box alert(testScore); It works fine. Unfortunately, I do not like the sound and Exclamation point icon that appears. I'd like a nice message box like VBA message box #64 to appear. I know hardly anything at all about VB or VBA. But, I do know you can call a VB function from Javascript. How? Is it
4
1535
by: Pekka Niiranen | last post by:
Hi, I am running Python script in W2K or in WinXP. The script is started from DOS prompt and writes text file to disk with codecs.open() in UTF8. The problem is: When script writes the file and tries to read it with by calling itself thru subprocess() the created files are NOT accessible because they have not been written into disk yet. fh.flush() and os.fsync() do not work.
4
11214
by: nidhikhandelwal | last post by:
I am calling a unix shell script from a perl script by using the following system command: system("./readfile_new.sh"); but it seems the unix script readfile_new.sh is not being called. Can someone let me know how to call this script in the perl file/
5
2828
by: Maxim Veksler | last post by:
Hello list, I'm trying to write a python script that would allow me to manipulate shell variables of the calling shell. I'm trying to write some logic that would know to add LD_LIBRARY_PATH to the users environment. In bash this is done with "export", can I do this with python? (If at all possible because python is actually a sub process of bash). Thank you,
9
15524
by: Catherine Moroney | last post by:
I have one script (Match1) that calls a Fortran executable as a sub-process, and I want to write another script (Match4) that spawns off several instances of Match1 in parallel and then waits until they all finish running. The only way I can think of doing this is to call it as a sub-process, rather than directly. I'm able to get Match1 working correctly in isolation, using the subprocess.Popen command, but calling an instance of Match1...
0
8249
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8179
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8633
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4187
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.