• 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.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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