473,513 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP web interface for shell script or command

I am looking for a web interface for shell commands or shell scripts.
Does anyone know of any exexisting php scripts which would solve this
requirement?

PHP form accepts input from a user, then passes these as arguments to
a configurable shell script or OS command. I would like for the
output generated from the shell script/command shall be displayed in a
new javascript window once the form is submitted. Optimally a user
should not not be able to make the program run more than once from
within the javascript window by reloading the window. program
execution shall only be caused by submitting the original form.

-Inet
Jun 27 '08 #1
5 5068
On Jun 12, 4:15 pm, Michael Vilain <vil...@NOspamcop.netwrote:
In article
<c1620cd5-0506-440a-b259-f0e815e64...@a70g2000hsh.googlegroups.com>,

inetquestion<inetquest...@hotmail.comwrote:
I am looking for a web interface for shell commands or shell scripts.
Does anyone know of any exexisting php scripts which would solve this
requirement?
PHP form accepts input from a user, then passes these as arguments to
a configurable shell script or OS command. I would like for the
output generated from the shell script/command shall be displayed in a
new javascript window once the form is submitted. Optimally a user
should not not be able to make the program run more than once from
within the javascript window by reloading the window. program
execution shall only be caused by submitting the original form.
-Inet

Sounds like a homework assignment or something assigned in a beginner's
PHP class. Why not try to write you own version and when you get stuck,
post your problems to this group. You might learn something. Just a
thought.

Alternately, you can look at some of stuff in various php libraries.
Lots of php developers from various countries have posted code to
various PHP sites (hint: it starts with "g" and ends with "e").


Lots of the requirements were simplified down to make the request seem
simplistic and consumable to a broader base. I assure you I'm long
past homework problems. :)

The root problem I'm trying to work around is I have a shell script
that SSH's out to many servers using ssh key-pairs and performs
various commands on each one (based on the input options/arguments)
This needs to run as a specific user and needs for the environment
from which it runs to be setup properly. when I setup a php based
form to execute these commands, the shell it runs under is...limited
at best. I have even tried sourcing the user's .profile as part of
this routine, but that didn't' get me much farther. Is there a way to
control what user the script will actually run as? Now back to my
original questions... Are there any php utilities anyone knows of
which can serve as an interface to a shell script or command line?

-Inet
Jun 27 '08 #2
inetquestion wrote:
On Jun 12, 4:15 pm, Michael Vilain <vil...@NOspamcop.netwrote:
>In article
<c1620cd5-0506-440a-b259-f0e815e64...@a70g2000hsh.googlegroups.com>,

inetquestion<inetquest...@hotmail.comwrote:
>>I am looking for a web interface for shell commands or shell scripts.
Does anyone know of any exexisting php scripts which would solve this
requirement?
PHP form accepts input from a user, then passes these as arguments to
a configurable shell script or OS command. I would like for the
output generated from the shell script/command shall be displayed in a
new javascript window once the form is submitted. Optimally a user
should not not be able to make the program run more than once from
within the javascript window by reloading the window. program
execution shall only be caused by submitting the original form.
-Inet
Sounds like a homework assignment or something assigned in a beginner's
PHP class. Why not try to write you own version and when you get stuck,
post your problems to this group. You might learn something. Just a
thought.

Alternately, you can look at some of stuff in various php libraries.
Lots of php developers from various countries have posted code to
various PHP sites (hint: it starts with "g" and ends with "e").



Lots of the requirements were simplified down to make the request seem
simplistic and consumable to a broader base. I assure you I'm long
past homework problems. :)

The root problem I'm trying to work around is I have a shell script
that SSH's out to many servers using ssh key-pairs and performs
various commands on each one (based on the input options/arguments)
This needs to run as a specific user and needs for the environment
from which it runs to be setup properly. when I setup a php based
form to execute these commands, the shell it runs under is...limited
at best. I have even tried sourcing the user's .profile as part of
this routine, but that didn't' get me much farther. Is there a way to
control what user the script will actually run as? Now back to my
original questions... Are there any php utilities anyone knows of
which can serve as an interface to a shell script or command line?

-Inet
No utilities I know of - just the standard system(), exec(), etc. commands.

The command will run as the PHP user - this is how the OS works, and PHP
has no control over it. If you're running under Linux, you can use sudo
to change the user. Also, you *could* use posix_setuid() to change the
user id, but this requires special privileges on the PHP executable and
is *very dangerous*.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #3
I have considered the following conditions, but ran into problems with
each...

1. The Web server runs as 'nobody' which cannot be modified. php
scripts executed will be executed as nobody...and script doesn't
work. For what I'm trying to do setuid probably isn't a good fit due
to security concerns.

2. web interface could write form inputs to a file. A daemon would
read items off the file and execute the intended script running as the
proper user. (seems clunky to me, but would work...)

3. Any other suggestions?

-Inet

Jun 27 '08 #4
On Jun 12, 10:21 pm, inetquestion <inetquest...@hotmail.comwrote:
I have considered the following conditions, but ran into problems with
each...

1. The Web server runs as 'nobody' which cannot be modified. php
scripts executed will be executed as nobody...and script doesn't
work. For what I'm trying to do setuid probably isn't a good fit due
to security concerns.

2. web interface could write form inputs to a file. A daemon would
read items off the file and execute the intended script running as the
proper user. (seems clunky to me, but would work...)

3. Any other suggestions?

-Inet
I wish I would have saved my code!! prior to my current job as a web
developer I use to work Help Desk. I was using php from the command
line to 'code myself out of a job' . I don't remember much from it but
what I can recall you won't have much with system_exec("ssh -u root
blah blah vlah") because you won't be able to interact with it after
that.

You need to play around with sockets, google for php telnet sockets or
something to that nature . I may have the bookmarks somewhere. I think
I may have printed out what code I did have and filed it under CS at
my desk. I think they way I was going to do it was have a listing
service that the front end connect to. The service keeps the
connection alive/open new ones. I'll see what I have/remember when I
get back to work Monday, I think you get the gist of the idea. I wish
I had more for you as I was going down this route before.
Jun 27 '08 #5
On Jun 13, 4:36 pm, The Hajj <hajji.hims...@gmail.comwrote:
On Jun 12, 10:21 pm,inetquestion<inetquest...@hotmail.comwrote:
I have considered the following conditions, but ran into problems with
each...
1. The Web server runs as 'nobody' which cannot be modified. php
scripts executed will be executed as nobody...and script doesn't
work. For what I'm trying to do setuid probably isn't a good fit due
to security concerns.
2. web interface could write form inputs to a file. A daemon would
read items off the file and execute the intended script running as the
proper user. (seems clunky to me, but would work...)
3. Any other suggestions?
-Inet

I wish I would have saved my code!! prior to my current job as a web
developer I use to work Help Desk. I was using php from the command
line to 'code myself out of a job' . I don't remember much from it but
what I can recall you won't have much with system_exec("ssh -u root
blah blah vlah") because you won't be able to interact with it after
that.

You need to play around with sockets, google for php telnet sockets or
something to that nature . I may have the bookmarks somewhere. I think
I may have printed out what code I did have and filed it under CS at
my desk. I think they way I was going to do it was have a listing
service that the front end connect to. The service keeps the
connection alive/open new ones. I'll see what I have/remember when I
get back to work Monday, I think you get the gist of the idea. I wish
I had more for you as I was going down this route before.
Any examples you have would be great. In the meantime I will checkout
your suggestion.

Jun 27 '08 #6

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

Similar topics

4
12058
by: Laura P | last post by:
Hi, I wasn't sure whether this should be posted in the Java are or in a Solaris thread, so I shall post it in both. Sorry for the duplication. I am new to Solaris and am having trouble...
3
3693
by: FPGA05 | last post by:
Hello All, I am developing a small application in which I would need a C++ application to read the output from a shell script. A shell script keeps looking for user inputs and once the user...
4
4112
by: mailar | last post by:
Hi, I am trying to register my UDF named 'myUDF.sql" (which has @ as its command terminating character) with sample database I am able to do so through the Linux shell prompt using the following...
0
1402
by: chettiar | last post by:
Hi, I am new to shell scripting. I need to use the db2_all command in a shell script can someone help. I need to use the following command in the shell script: db2_all <<-0< db2 conncet to...
9
78205
by: sohan | last post by:
Hi, I want to know how to connect and execute a db2 query from inside a UNIX shell script. Details: We have a unix shell script. We need to execute multiple db2 sql queries from this shell...
1
8218
by: Rafael Fernandez | last post by:
Hi folks, I have the following sql/pl: CREATE PROCEDURE DBSTG.TEST (OUT PRESULT INTEGER ) SPECIFIC DBSTG.TEST DYNAMIC RESULT SETS 1 LANGUAGE SQL
9
14187
by: niteck07 | last post by:
I am using following shell script to ftp files to another server but this is failing as the shell script changes the user name for the ftp login the correct user name is 'ag\invprint' which the...
7
6204
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
3
9578
by: xtremebass | last post by:
Hi , I am want to run the shell script to run every 10 minutes of interval ,so that i have used crontab command for scheduling the shell script .. it cant works . i have checked wall command in...
0
7265
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,...
0
7171
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...
0
7388
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,...
0
7539
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...
1
5095
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...
0
4751
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...
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.