473,770 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to setuid scripts

9 New Member
please help me...
Hi i want to run a php program using linux command....
php program is stored in /var/www/html/t.php
that program is
<?php
$command='ooffi ce -invisible "macro:///Standard.Module 4.Main()"';
print system($command );
echo"successful ly converted";
?>
the above program is run in terminal....
[root@localhost html] php t.php
successfully run
But doesnot run in browzer...

somebodys told set uid .....
I dont know how to setuid in terminal ...
so please help me...
Apr 2 '08 #1
6 3630
micmast
144 New Member
if you want to run a php program in your terminal you need to add an argument I think it is -r but quickly read the manual
-> man php
Apr 2 '08 #2
thirusvga
9 New Member
I can run in terminal easily..But i didnt run in browzer...i am using linux fedor7 ...
how i setuid....
Apr 2 '08 #3
thirusvga
9 New Member
do u understand my question..
I was able to run a linux syatem command in browser through php like sample date function using php...
<?php
print exec('date');
?>
it was successfully run in browser....but some programs are not run in browser..
my php programs are stored in /var/www/html.......
any way is there... please tell me...
Apr 3 '08 #4
prn
254 Recognized Expert Contributor
I just answered another question that probably overlaps a great deal with yours. As in the other question, this is almost certainly just what you suggest here: a question of the fact that the "user" running the web server is not root (or whoever) so you need to grant limited privs to the web server. The discussion below "Now here comes the warning" in that post should be the answer here too.

HTH,
Paul
Apr 4 '08 #5
thirusvga
9 New Member
I am a root user.. and also did grant permission ...is there any possibilities here after..
Apr 9 '08 #6
prn
254 Recognized Expert Contributor
I am a root user.. and also did grant permission ...is there any possibilities here after..
You may be root, but when you run a script from a browser, root is not (or at least should not be) running the script --- the web server user (probably www or httpd) is running the script on your behalf. To whom did you grant permission?

At least 80% of the time when one user can run something and another cannot the problem is some kind of permission problem. Virtually all the rest of the time, it is an environment problem. The first question is "who is your web server user?" For example:
Expand|Select|Wrap|Line Numbers
  1. [root@foo ~]# ps -ef | grep httpd
  2. www       2248     1  0 Jan04 ?        00:00:00 /usr/bin/perl /home/httpd/perl/bar
shows that www is the user that actually runs the webserver on host "foo". So, does www have permission to run your script. If you are root, do:
Expand|Select|Wrap|Line Numbers
  1. [root@foo ~]# su - www
(don't forget the "-" in that command!!!) and then try to run the script. Does it run properly? If yes, then we'll have to come up with another hypothesis, but I would be very surprised if it does. You are likely to get some kind of informative error message if it does not.

Let us know what happens.

HTH,
Paul
Apr 9 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4938
by: Ben Eisenberg | last post by:
I'm trying to run a php script setuid. I've tried POSIX_setuid but you have to be root to run this. The files are located on a public access unix system and have me as the owner and nobody as the group. Rather than make them group writable where in anybody could make a script and write to my files i would like to make them setuid. I tried making a c prog with the setuid function. I used chmod and made it setuid. I called it with the system...
0
1506
by: Dave Harrison | last post by:
hi again, Im clearly a moron, and have solved the problem myself, due to a wish to avoid dire embarrasment I shall not reveal the stupid mistake I made ;-) Apologies for the inconvenience Dave > hi all, >
1
2594
by: Domenico Andreoli | last post by:
Hi, I did a little research about execution of Python setuid scripts. I found only a couple of C wrappers I don't like. So I wrote my own, it is available at . Feel free to send comments. 2c http://savannah.nongnu.org/cgi-bin/viewcvs/prua/prua/python-setuid.c
3
8406
by: Michele Simionato | last post by:
I have a script that sometimes is run by myself (user id 501) and sometimes by the mailer program as nobody/nogroup (userid 65534). I would like to change the effective uid to 501 in any case, to get the right permissions, but os.setuid and os.seteuid give me a OSError No. 1. Is there a way to get what I want? My requirement is that the script should work indipendently from the mailer program, i.e I would like to avoid configuring the...
3
9290
by: pasear | last post by:
I find I can't run setuid perl script when I do this on a Unix-like platform: 1.Create a file "setuid.pl": #!/usr/bin/perl -T 2.chmod a+x setuid.pl 3.chmod u+s setuid.pl then i try
1
6408
by: Chris | last post by:
Thanks to Ingo for refering me to this group. I'm a newbie with perl scripts and I'm having problem running my copied script to my server. Can anybody who is patient enough to help me with my problem? I have a chpass.pl which is being executed by a change password web utility page. This script tries to update a password on my linux server /etc/shadow with a file permision rw------. my chpass.pl was set to -rwsr-sr-x , with this file...
3
3774
by: Tiago Simões Batista | last post by:
Hello all I have a situation that requires that a python script, that is run from a webpage (via php exec()) must be run with root privileges. The sysadmin already set the setuid bit on the script, but it still fails when it tries to write to any file that only root has write access to. I read somewhere that any scripts that start with "#!" will no
2
2534
by: Stu | last post by:
Is there anyway to tell if a setuid() call has been made to some other user? If so, can somebody provide me with some sample code Thanks in advance to all that answer
1
3739
nimisha m
by: nimisha m | last post by:
what are setuid/setgid perl scripts?
0
9618
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
10259
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
10101
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
9906
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...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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 we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.