• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Resolved How use command runuser with vhost user?

Azurel

Silver Pleskian
I have a bash script with this command

USER="myvhostuser"
runuser -l "$USER" -c "$DAEMON $SERVER >> $LOG_FILE &" && echo_success || echo_failure

With USER="root" its working fine, but with USER="myvhostuser" its failed. How I can use this with user from a plesk subscription (vhost domain)?

/var/www/vhosts/example.com
Owner: myvhostuser
Group psaserv

For security reason I can't use the bash with "root" user.

I hope anyone understand what I mean. ^^
 
Hi Azurel,

the command "runuser" may ONLY be executed by the user "root". ( should be documented within your man - pages as well. ;) )

( Pls. remember, that this is not a PLESK - related topic, so pls. consider to open a thread at => Home > Forum > General Discussion > Open Topics for such topics )
 
Yes, I want execute it with "root" but run as user (security reason).

I want execute a nodejs bot. Manual I do it successful with
# /opt/plesk/node/7/bin/node /var/www/vhosts/example.com/nodejs/client.js

But that script stops after close shell console. I wrote a bash script, so I can start and stop the bot like
# sh /var/www/vhosts/example.com/nodejs/bot.sh start

USER="myvhostuser"
DAEMON="/opt/plesk/node/7/bin/node"
ROOT_DIR="/var/www/vhosts/example.com/nodejs"
SERVER="$ROOT_DIR/client.js"
runuser -l "$USER" -c "$DAEMON $SERVER >> $LOG_FILE &" && echo_success || echo_failure

When I not want run this as root, as what then? The username of subscription and owner of vhost folder "example.com" not working. (The "bot.sh" working fine with "root" as user)


EDIT:
Maybe the problem ist with "/opt/plesk/node/7/bin/node" (installed with nodejs plesk extension) its owned by root (Owner/Group)
 
Last edited:
Hi Azurel,

runuser -l "$USER" -c "$DAEMON $SERVER >> $LOG_FILE &" && echo_success || echo_failure
If you desire to use the "-u" string in front of your "$USER", you should as well use it within your command. ;)
 
Hi Azurel,

runuser have no -u parameter
Interesting... well, let's quote from your link then :rolleyes::
runuser [options] -u user [[--] command [argument...]]

runuser [options] [-] [user [argument...]]

... AND ...
Code:
...
      If the option -u is not given, it falls back to su-compatible
      semantics and a shell is executed. ...
 
Back
Top