Link to home
Start Free TrialLog in
Avatar of Yudo Hartono Tri Sunu
Yudo Hartono Tri SunuFlag for Indonesia

asked on

why expect can't found if run from apache server

i have problem with my expect

1. if we run script close_all.sh from terminal openBSD it's run normal
2. if we run test.php to run close_all.sh from php CLI it's normat too

but if we run from browser with Apache server the script error like this

./close_all.sh[37]: expect: not found

apache have group wheel

this error appear after we use Eclipse RSE to this server and until now still error

thanks before, please help
#!/bin/bash
expect << EOF
spawn su
expect "*:"
send "$1\n"
expect "*#"
send "chmod  640 /etc/passwd \n"
expect "*#"
send "chmod  600 /etc/master.passwd \n"
expect "*#"
send "chmod  640 /etc/pf.conf \n"
expect "*#"
send "chmod  640 /etc/hosts \n"
expect "*#"
send "chmod  640 /etc/hostname.* \n"
expect "*#"
send "chmod  640 /etc/mygate \n"
expect "*#"
send "chmod  644 /etc/resolv.conf \n"
expect "*#"
send "chmod  640 /etc/ssh/sshd_config \n"
expect "*#"
send "chmod  644 /etc/dhcpd.conf \n"
expect "*#"
send "chmod  644 /etc/myname \n"
expect "*#"
send "chmod  644 /etc/group \n"
expect "*#"
send "exit\n"
exit

EOF

Open in new window

<?php
$command ="sh /close_all.sh passadmin";
$closefile =shell_exec($command);
echo $closefile;
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of svgmuc
svgmuc
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Yudo Hartono Tri Sunu

ASKER

this works perfect for me