Run hestia scripts not as root

Hi all
Can someone advice me on how to run

v-add-domain
v-add-web-domain-redirect
v-add-letsencrypt-domain

not as root?

I created new user on the server which i want to use to add domains.
But when run i see errors like.

/usr/local/hestia/bin/v-add-domain: line 23: /usr/local/hestia/func/main.sh: Permission denied
/usr/local/hestia/bin/v-add-domain: line 27: source_conf: command not found
/usr/local/hestia/bin/v-add-domain: line 32: check_args: command not found
/usr/local/hestia/bin/v-add-domain: line 33: is_format_valid: command not found
/usr/local/hestia/bin/v-add-domain: line 37: is_object_valid: command not found
/usr/local/hestia/bin/v-add-domain: line 38: is_object_unsuspended: command not found
/usr/local/hestia/bin/v-add-domain: line 41: check_hestia_demo_mode: command not found
grep: /usr/local/hestia/data/ips/*: Permission denied
grep: /usr/local/hestia/data/ips/*: Permission denied
/usr/local/hestia/func/ip.sh: line 243: check_result: command not found
grep: /usr/local/hestia/data/ips/: Permission denied
/usr/local/hestia/bin/v-add-domain: line 51: check_result: command not found
/usr/local/hestia/bin/v-add-domain: line 87: /v-restart-web: No such file or directory
/usr/local/hestia/bin/v-add-domain: line 88: check_result: command not found
/usr/local/hestia/bin/v-add-domain: line 90: /v-restart-proxy: No such file or directory
/usr/local/hestia/bin/v-add-domain: line 91: check_result: command not found
/usr/local/hestia/bin/v-add-domain: line 93: /v-restart-dns: No such file or directory
/usr/local/hestia/bin/v-add-domain: line 94: check_result: command not found

if the user has sudo permissions you can run it with sudo

if not only via web ui

sudo -i to switch to sudo as current user
then
v-add-domain user domain.tld

example: v-add-domain leonk example.com

You only only need sudo -i to obtain a root shell. The su is unnecessary. There is also no need to preface commands with sudo after obtaining an interactive shell with sudo -i.

True. I guess I was remembering from earlier times. Hardly use sudo anymore myself.

1 Like

I can relate. I remember using sudo su - 25 years ago before sudo gained the -i flag in 2004.