I have build a form (using JavaScript, jQuery, PHP and HTML) that makes it easy for the non-technical people to compose and fire the command that creates an ISO image containing the CentOS Linux and a company application built along with it. Here is the actual command with sample variables.
./test.pl --verbose --output tvmTEST.iso --virtual --isv 4.1.5.1.4147.8.0 --64bit --netproto static --hostname tvmTEST --address 192.168.5.235 --netmask 255.255.255.0 --gateway 192.168.5.252 --nameserver 192.168.5.21,192.168.5.2
This exact command works properly when fired from the shell while logged in as root and the ISO gets created successfully. However, it doesn't work through the GUI. The form composes the command properly and passes it to the PHP code where I am calling the perl program. I had the command composed by PHP program tested in the shell and it created the ISO! Here is the perl program that builds the ISO image. It is being run as user apache when fired through the form. But, it dies at line # 665 where it says:
system("sudo mount -o loop $c{centosiso} $mp") and die;
I tried printing the string passed to system()
above and it printed:
sudo mount -o loop /tmp/test.pl-cache/CentOS-5.4-x86_64-bin-1of7.iso /mnt/CentOS
So, I tried firing this command through the shell and it actually mounted the ISO! However, the permissions for /mnt/CentOS
changed to 755
. Its not clear to me WHY? Note that I tested it with and without sudo
in that line above.
And, prior to this, the permissions for /mnt/CentOS
were set to 777
and owner was set as apache
! Is these permissions the reason why my form isn't working? Am I on the right track?