Reputation: 13
php testplesk.php
testplesk.php :
<?php
/// testplesk.php
exec('php testshell.php');
?>
testshell.php :
<?php
/// testshell.php
shell_exec('sudo sh newplesk.sh');
?>
newplesk.sh :
plesk bin subscription --create 6.domain.tld -owner admin -service-plan "Default Domain" -ip xxx.xxx.xxx.xxx -login jdoe6 -passwd "pwd6"
All of these files are chown in xxx:psacln
Any help please ? Best Regards.
EDIT (Reason : Answer)
The web user had to be in sudoers and the path to plesk in absolute path
nano /etc/sudoers
Last line of "sudoers" :
yourwebuser ALL = NOPASSWD: /usr/sbin/plesk
newplesk.sh (modified & with var) :
sudo /usr/sbin/plesk bin customer --create $1 -name $2 -passwd sample -phone $4 -company $5 -email $6 -notify false
Thanks to Luka who helped me for that
Upvotes: 0
Views: 1155
Reputation: 46
Actually your method is unsecure. I think you can do your process with Plesk API.
For example:
curl -i -X GET -u admin:***** "https://yourserver-address:8443/api/v2/server"
You can run this command with PHP curl or guzzle.
This method is safer and more convenient than the previous one.
Upvotes: 1