• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

How to access plesk 11 cli tools from Webscripts (correctly) ?

cts-service

New Pleskian
Hi,

I have a private Admin-Webspace written in PHP to do some Server Tasks with shell exec functions.

The Webuser is running under fastcgi permissions.
I put him into /etc/sudoers
Then I enabled the function: Users can use their own webscripts for this particular domain and shell access to bash.

Logging in with ssh as user ftp_user and executing the shell admin script from terminal is no problem at all!

But using the browser, opening the php script and then doing a shell exec always throws me an error.


To make it clear, here a snippet (just example):
creating /var/www/vhosts/domain.com/adminpanel/test.php

test.php:
Code:
#!/bin/bash

KD_DB_PW="ihg45kjbOJGoghigb456ojojbn"
PLESK_PATH="/usr/local/psa/bin/"
DB_USER="test"

PSA_PASSWORD='As45fgIpvi45fgtj2'


echo "setting up hosting";

echo "creating user";

sudo -i -uroot $PLESK_PATH/./customer --create "$DB_USER" \
	-name "Plesk User: $DB_USER" -passwd "$DB_PW" \
	-notify false -owner pleskadmin ' '

The Plesk admin environment variable, how do I use it in scripts?
I always get the error:
Code:
Could not open Repository at "/etc/sw/keys": Cannot open file
Unable to connect to database: get_admin_password() failed: file_get_contents() failed:
 
Last edited:
Back
Top