Search code examples
bashvagrantvvv-wordpress

What does "noroot" means in Variant Vagrant Vagrant (VVV) scripts


I'm trying to write a custom provisionner for VVV. I've noticed that many command lines in shell scripts are prefixed by 'noroot'.

Here are a few examples:

  noroot mkdir -p "${VVV_PATH_TO_SITE}/log"
  noroot touch "${VVV_PATH_TO_SITE}/log/nginx-error.log"
  noroot wp plugin install "${plugin}" --activate

I can't figure out what is the purpose of 'noroot'.

Could anyone explain me what is 'noroot' and where to find some doc about it.

thank you.


Solution

  • It turns out that noroot is a specific function defined in VVV core scripts contained in VVV-path/provision/provision-helpers.sh:

    function noroot() {
      sudo -EH -u "vagrant" "$@";
    }
    export -f noroot
    

    It runs the command following norootas the user vagrant