Access virtualbox shared folders from Ubuntu and fix ruined ubuntu installation.

If you are running Ubuntu virtualbox guest then you cannot access the shared folder under /media/shared with regular user. However you can fix this by adding your user to vboxsf additional group.

Important! make sure you append the additional group so that other groups are not removed! Run te command below as exactly as seen and replace you username. If the permission is not applied immediately then reboot.

usermod -a -G vboxsf username

In case you forgot flag -a then it is bad but not hopeless 🙂

If you dont have any more sudoers users then you cannot do any more administration tasks.

$ sudo apt-get update
[sudo] password for username:
username is not in sudoers file. This incident will be reported.

Verify the problem

$ id
uid=1000(username) gid=1000(username) groups=1000(username),1001(vboxsf)

You have to hack into the root account to fix it. Reboot the ubuntu and hold shift key when booting. You will see grub menu where you must choose recovery mode

From Recovery menu choose “Drop to root prompt”

Now begins the most frustruating point if you dont know the trick. You have to add user back to group sudo which gives supercow powers.

# usermod -a -G sudo username
usermod: cannot lock  /etc/passwd; try again later

Whatever you do it seems like whole hard disk is corrupted and only solution is to reinstall the linux or restore from snapshot if you are lucky enough to have it.

Actually solution is pretty easy. By default Ubuntu root shell comes in read-only mode. To have it writable again just type:

# mount -o rw,remount /

Now run again the usermod to add yourself to sudo group and after restart you are happy again.

 


1 thought on “Access virtualbox shared folders from Ubuntu and fix ruined ubuntu installation.

Leave a Reply

Your email address will not be published.


*