- Plesk Onyx for Linux
Is it possible to run 'npm' executables shipped by Plesk under a system user other than root?
npm executables, located in
/opt/plesk/node/*/bin are, in fact, symbolic link to corresponding JS scripts:
# ls -l /opt/plesk/node/*/bin/npm
lrwxrwxrwx 1 root root 38 Apr 27 00:49 /opt/plesk/node/8/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 root root 38 Apr 27 00:49 /opt/plesk/node/9/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
These scripts can be executed by any system user which has an access to the shell:
# ls -l /opt/plesk/node/*/lib/node_modules/npm/bin/npm-cli.js
-rwxr-xr-x 1 root root 2758 Apr 3 17:31 /opt/plesk/node/8/lib/node_modules/npm/bin/npm-cli.js
-rwxr-xr-x 1 root root 2758 Apr 3 17:32 /opt/plesk/node/9/lib/node_modules/npm/bin/npm-cli.js
# grep example /etc/jdoe
# su - jdoe
Last login: Mon Jun 11 02:20:50 +07 2018 on pts/0
-bash-4.2$ /opt/plesk/node/9/bin/npm -v
To allow shell access to a system user registered in Plesk, make sure that Can allow access to any type of shell option is checked in the subscription settings or on the subscription service plan and /bin/bash or /bin/sh is selected in Domains > example.com > Web Hosting Access > Access to the server over SSH.