Virtualmin - how to get same ENV Variable like in CLI (bash)?

OS type and version Ubuntu Linux 20.04.6
Webmin version 2.021
Usermin version 1.861
Virtualmin version 7.7
Theme version 20.21
Package updates All installed packages are up to date

I have a custom command which installs nvm in a user-context:

During install-process, it add some entries to bashrc to make it work as expecting.
This is added at the end of .bashrc

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

If I login as user, and do node --version I see my choosed Version 18.15.0.

But if I do execute same command node --version via custom commands, I see another node-version (10.x) which is not from nvm.

So I’ve added the command env to custom commands and found, that there are no path to nvm-node are added.
I tried with the same user in both cases. Means on CLI & via Virtualmin (switch into VM-Server Admin as user)


  1. How to make the custom commands environment variables equal to the bash-ones?
  2. Why does custom commands don’t have the same env-vars / values as bashrc has? (in wich context does the user run here?)

BTW: I’ve tried to create and use ‘Virtuamin → System Customization → Global Variables’ for custom-commands, but don’t get it to work. Any suggestion how to use this?