0

Every time I execute my script with:

exec('sudo profile status-koneksi',$status);
print_r($status);

it always does nothing, I have no idea how to debug this one, my script requires root permission so I appended the following lines to /etc/sudoers file:

Cmnd_Alias ANGEL_BEATS = /usr/bin/profile, /usr/bin/socks, /usr/bin/gsm, /usr/bin/gssh, /usr/bin/ping_loop, /usr/bin/restart-openvpn, /usr/bin/sms.py, /usr/bin/sms_gateway, /usr/bin/socks, /usr/bin/ussd.py, /usr/bin/vpn, /usr/bin/wgetui
ab ALL=NOPASSWD: ANGEL_BEATS
%ab ALL=NOPASSWD: ANGEL_BEATS

However, it works just fine when I execute the command from my terminal: enter image description here

How do I solve this ?

UPDATE:

As suggested by a comment below, I run this script:

if(exec("sudo sh /usr/bin/profile status-koneksi 2>&1", $output, $return_var)){ print_r($output); print_r($return_var); }

And it returns:

Array ( [0] => sudo: no tty present and no askpass program specified ) 1
hillz
  • 537
  • 6
  • 10
  • 18

1 Answers1

0

Since your script requires root permission to run, it would be nice if you could set the setuid bit. Try this:

chmod u+s <your_script>

More info here (from Wikipedia)

Runcy Oommen
  • 484
  • 2
  • 12