how to setuid scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thirusvga
    New Member
    • Feb 2008
    • 9

    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='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...
  • micmast
    New Member
    • Mar 2008
    • 144

    #2
    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

    Comment

    • thirusvga
      New Member
      • Feb 2008
      • 9

      #3
      I can run in terminal easily..But i didnt run in browzer...i am using linux fedor7 ...
      how i setuid....

      Comment

      • thirusvga
        New Member
        • Feb 2008
        • 9

        #4
        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...

        Comment

        • prn
          Recognized Expert Contributor
          • Apr 2007
          • 254

          #5
          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

          Comment

          • thirusvga
            New Member
            • Feb 2008
            • 9

            #6
            I am a root user.. and also did grant permission ...is there any possibilities here after..

            Comment

            • prn
              Recognized Expert Contributor
              • Apr 2007
              • 254

              #7
              Originally posted by thirusvga
              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:
              Code:
              [root@foo ~]# ps -ef | grep httpd
              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:
              Code:
              [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

              Comment

              Working...