non root user

Discussions related to using VirtualBox on Linux hosts.
Post Reply
stipan
Posts: 5
Joined: 12. Apr 2017, 19:27

non root user

Post by stipan »

Hello ,

I apologize if this is replication of existing issue.

Ok, I am using virtualbox on ubuntu 16.04.
I have created VM called "ubuntu" as user1.
So, now I am wondering is there some way to access to my VM as user2.

My purpose is to monitor VM.

So for example if I try to execute following command as user2 : "VBoxMange showminfo ubuntu", i get following error:
"VBoxManage: error: Could not find a registered machine named 'ubuntu'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(VMNameOrUuid).raw(), machine.asOutParam())" at line 2719 of file VBoxManageInfo.cpp"
Maybe, is there some way to execute VBoxManage and pass username and password as parameters that is also option?
So, My purpose is just to monitor VM (usage of cpu, memory, is it in running state) from user that is different than user1, so I will welcome every suggestion...
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: non root user

Post by socratis »

VirtualBox runs on the user context that created/launched the VM. So, no, you can't directly do what you are looking for. You could be looking at the other user's screen (or a remote computer, same thing) if you enable the RDP server in the VM. See Chapter 7. Remote virtual machines.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: non root user

Post by Perryg »

My purpose is to monitor VM.
Only way I can think of is to use the metrics measuring from VBoxManage
http://www.virtualbox.org/manual/ch08.html#metrics
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: non root user

Post by socratis »

Using the "metrics" however, would still require to be checking from the same account as the user that created/launched the VM, 'user1' in this case. And by re-reading the title of the thread, not even 'root' could have access to the VMs of 'user1', if that's what 'stipan' was thinking of.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
stipan
Posts: 5
Joined: 12. Apr 2017, 19:27

Re: non root user

Post by stipan »

yeah, Socratis got a point.
If I try to use VBoxManage user2 can't see VM. I got following error : "VBoxManage: error: Invalid machine name: 'ubuntu'" cause he can not see machine.

So, as user2 there is no way to monitor user1 VMs?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: non root user

Post by Perryg »

So, as user2 there is no way to monitor user1 VMs?
Sure there is just not by default. Permissions will not let users see each other, but you can place the virtual machines in a common location and setup the permissions where all users can see. It is just not secure. You would need to create or use a group that each user is in with the proper permissions. This is however outside the scope of what VirtualBox is designed to do ( isolate users ) so there probably will not be a lot of help here.
stipan
Posts: 5
Joined: 12. Apr 2017, 19:27

Re: non root user

Post by stipan »

So, if I get it right, the best solution is to use another software
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: non root user

Post by Perryg »

I fail to see how that would solve your problem but a different program is as always your option. AFAIK all virtualizers try to isolate these machines for security.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: non root user

Post by socratis »

Perryg wrote: but you can place the virtual machines in a common location and setup the permissions where all users can see.
That would allow you to simply have access to, and launch a "common" VM. It wouldn't allow you to monitor the process launched by user1 from the user2 account. I believe the reason is the VBoxSVC process which is responsible for holding the registry/status of all the user's running VMs. I think only root could do that, or by:
  • su user1; launch VM; monitor VM
As Perryg mentioned the design logic behind VirtualBox was user isolation.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
stipan
Posts: 5
Joined: 12. Apr 2017, 19:27

Re: non root user

Post by stipan »

in yours opinion, Is there some way to implement a script that will do it, so User2 just run it and get infos? So he doesn't have to know that in the background you do all that su stuff you mention?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: non root user

Post by socratis »

No.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
stipan
Posts: 5
Joined: 12. Apr 2017, 19:27

Re: non root user

Post by stipan »

great thank you very much :mrgreen:
Post Reply