473,287 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

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 5053
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
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
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
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
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
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
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
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
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
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.