• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

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