The following is based on the following:
Login to your ERPNext machine
Change to the frappe user with sudo
sudo -u frappe -s -H cd ~frappe-bench bench update