From 7df722143628341333a250e5cc55555ed5aaf32b Mon Sep 17 00:00:00 2001 From: Dmitry Shmygov Date: Mon, 8 Dec 2014 02:03:06 +0300 Subject: [PATCH] Run VirtualBox as another user (Linux only) --- gns3server/modules/virtualbox/__init__.py | 2 +- gns3server/modules/virtualbox/virtualbox_vm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/virtualbox/__init__.py b/gns3server/modules/virtualbox/__init__.py index abf64881..dbc0cef2 100644 --- a/gns3server/modules/virtualbox/__init__.py +++ b/gns3server/modules/virtualbox/__init__.py @@ -727,7 +727,7 @@ class VirtualBox(IModule): """ try: - if not user.strip(): + if not user.strip() or sys.platform.startswith("win") or sys.platform.startswith("darwin"): result = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=30) else: sudo_command = "sudo -i -u " + user.strip() + " " + " ".join(command) diff --git a/gns3server/modules/virtualbox/virtualbox_vm.py b/gns3server/modules/virtualbox/virtualbox_vm.py index bb99172a..bb1affc1 100644 --- a/gns3server/modules/virtualbox/virtualbox_vm.py +++ b/gns3server/modules/virtualbox/virtualbox_vm.py @@ -553,7 +553,7 @@ class VirtualBoxVM(object): log.debug("Execute vboxmanage command: {}".format(command)) user = self._vbox_user try: - if not user.strip(): + if not user.strip() or sys.platform.startswith("win") or sys.platform.startswith("darwin"): result = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=timeout) else: sudo_command = "sudo -i -u " + user.strip() + " " + " ".join(command)