I am using a separate HDD as a disk for my Virtualbox machine. I have made a vmdk
using the tutorial provided in the VirtualBox manual, but in order for the machine to run I have to constantly change the owner and group of the /dev/sdb
device to the user I am logged in with.
Time after time permissions get reset back to root:disk
, and I'm not certain when exactly that happens. What can I do to change the owner and group permanently or maybe to not have to do it at all?
The probably simplest and best way to fix the problem is adding your user to disk group.
Then logoff and login back, you should able to interact with hard drive from Virtualbox.
This overriding behavior you see is udev daemon, the system service which maintains those device files. It acts at boot time and whenever a device is added or removed.
To configure permissions for that disk so VirtualBox users can have raw access to it, you have to create a rule for udev in a file under /etc/udev/rules.d/. In your particular case, assuming your user is part of vboxusers group, that can be accomplished with a command like this: