473,387 Members | 1,585 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,387 software developers and data experts.

how to setuid scripts

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='ooffice -invisible "macro:///Standard.Module4.Main()"';
print system($command);
echo"successfully 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 3610
micmast
144 100+
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
I can run in terminal easily..But i didnt run in browzer...i am using linux fedor7 ...
how i setuid....
Apr 2 '08 #3
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 Expert 100+
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
I am a root user.. and also did grant permission ...is there any possibilities here after..
Apr 9 '08 #6
prn
254 Expert 100+
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
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...
0
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...
1
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...
3
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...
3
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
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...
3
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...
2
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
nimisha m
by: nimisha m | last post by:
what are setuid/setgid perl scripts?
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.