ronivay / XenOrchestraInstallerUpdater

Xen Orchestra install/update script
GNU General Public License v3.0
1.16k stars 189 forks source link

useSudo Option #100

Closed delgado23 closed 2 years ago

delgado23 commented 2 years ago

In the documentation there is a section to set useSudo = true in the config to allow xen orchestra to mount NFS shares when running it as a non root user. Would it been possible to implement the option to enable this feature in the script config file? https://xen-orchestra.com/docs/from_the_sources.html

delgado23 commented 2 years ago

Also just to be a little more clear I am okay with adding the mount and umount commands to the sudoers file it's just the flag to set to use sudo that I am requesting.

ronivay commented 2 years ago

Hi,

Thanks for suggestion. This is now implemented. Sample configuration file has two new settings: USESUDO and GENSUDO. They behave as following when set to true (default is false).

USESUDO will install sudo package if missing, set useSudo parameter to true in xo-server configuration and create a new directory to be used for mounts (default path under /run doesn't work and would be reset on every reboot if modified) and set this to be used in xo-server configuration. GENSUDO (if USESUDO is also true) will generate sudoers configuration to /etc/sudoers.d for necessary mount commands. This file is created only if it doesn't exist so that any manual modifications done afterwards aren't overwritten.

Give it a spin and let me know if this works for you.

delgado23 commented 2 years ago

Thank you! I will give it a try here later today.

delgado23 commented 2 years ago

I was able to successfully mount,backup, and restore a VM while xen orchestra was running as a non root user.

ronivay commented 2 years ago

Great! Will close this