The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WHM and passing PHP vars to shell

Discussion in 'General Discussion' started by sv70, Mar 9, 2009.

  1. sv70

    sv70 Active Member

    Joined:
    Dec 24, 2006
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    In one php script, I cannot pass this variable to shell:

    <?
    $var = 123;
    shell_exec("sh cp1.sh $var");
    ?>


    this is cp1.sh:
    -------------
    #!/bin/bash
    /usr/sbin/cp2 -u $1


    I'm receiving this Apache error:
    csp1.sh: line 2: /usr/sbin/cp2: Permission denied

    The owner : perms are:
    cp1.sh: root:0755
    /usr/sbin/cp2: root:0777

    I think the system execution is allowed because I can execute shell_exec() from a php script:
    <?
    $outpout = shell_exec("ls -l");
    echo "<pre>$output</pre>";
    ?>

    Is there any option in WHM preventing the cp1.sh execution?

    thanks!
     
Loading...

Share This Page