Skip to content

Instantly share code, notes, and snippets.

@jucke
Forked from magnetikonline/README.md
Created March 29, 2018 13:30
Show Gist options
  • Save jucke/a252ad64a95fe69c52a49025de14712a to your computer and use it in GitHub Desktop.
Save jucke/a252ad64a95fe69c52a49025de14712a to your computer and use it in GitHub Desktop.

Revisions

  1. @magnetikonline magnetikonline revised this gist Mar 5, 2018. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,10 @@
    # Install VirtualBox guest additions onto Ubuntu server guests
    Have tested these instructions successfully under an Ubuntu 16.04LTS guest with a VirtualBox 5.1 and 5.2 host.

    - [Install steps](#install-steps)
    - [Mount with guest/host permissions matched](#mount-with-guesthost-permissions-matched)
    - [Reference](#reference)

    ## Install steps
    - Create Ubuntu server instance under VirtualBox (obviously).
    - Start VM, goto **Devices - Insert Guest Additions CD image** to mount the ISO image.
    @@ -24,7 +28,7 @@ Have tested these instructions successfully under an Ubuntu 16.04LTS guest with
    - Host shares should now be mounted in Ubuntu guest under `/media` via the installed `VBoxService` service, set to start on system boot-up.
    - All done.

    ## Mount with guest/host permissions inline
    ## Mount with guest/host permissions matched
    By default with auto mounted shares, VirtualBox will set an interesting set of ownership and file/directory permissions for the guest which (for me) is sub-optimal. To correct this behavior and mirror permissions between host and guest we can do the following:

    - Shut down the guest (if not already) and ensure "Auto-mount" is _disabled_.
    @@ -58,3 +62,7 @@ By default with auto mounted shares, VirtualBox will set an interesting set of o
    ```

    - All done.

    ## Reference
    - https://askubuntu.com/questions/123025/what-is-the-correct-way-to-share-directories-in-mac-and-ubuntu-with-correct-perm/123156#123156
    - https://askubuntu.com/questions/252853/how-to-mount-a-virtualbox-shared-folder-at-startup/252865#252865
  2. @magnetikonline magnetikonline revised this gist Mar 5, 2018. 1 changed file with 35 additions and 0 deletions.
    35 changes: 35 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -23,3 +23,38 @@ Have tested these instructions successfully under an Ubuntu 16.04LTS guest with

    - Host shares should now be mounted in Ubuntu guest under `/media` via the installed `VBoxService` service, set to start on system boot-up.
    - All done.

    ## Mount with guest/host permissions inline
    By default with auto mounted shares, VirtualBox will set an interesting set of ownership and file/directory permissions for the guest which (for me) is sub-optimal. To correct this behavior and mirror permissions between host and guest we can do the following:

    - Shut down the guest (if not already) and ensure "Auto-mount" is _disabled_.
    - Restart the guest.
    - From the shell, determine the `umask` and `uid/gid` of your host user.

    ```sh
    $ umask
    0022
    $ id
    uid=1000(USERNAME) gid=1000(USERNAME) groups=1000(USERNAME),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lxd),115(lpadmin),116(sambashare)
    ```

    - Now mount the share as follows:

    ```sh
    $ mkdir --parents /path/to/share
    $ sudo mount.vboxsf -o umask=UMASK,uid=UID,gid=GID SHARE_NAME /path/to/share
    ```

    - If all is good, we can now add an entry to our `/etc/fstab`:

    ```
    SHARE_NAME /path/to/share vboxsf umask=UMASK,uid=UID,gid=GID 0 0
    ```

    - And remount all file systems

    ```sh
    $ sudo mount -a
    ```

    - All done.
  3. @magnetikonline magnetikonline revised this gist Mar 5, 2018. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    # Install VirtualBox 5.1/5.2 guest additions on Ubuntu server guest
    Have tested these instructions successfully under an Ubuntu 16.04LTS guest:
    # Install VirtualBox guest additions onto Ubuntu server guests
    Have tested these instructions successfully under an Ubuntu 16.04LTS guest with a VirtualBox 5.1 and 5.2 host.

    ## Install steps
    - Create Ubuntu server instance under VirtualBox (obviously).
    - Start VM, goto **Devices - Insert Guest Additions CD image** to mount the ISO image.
    - From the terminal, run the following commands:
  4. @magnetikonline magnetikonline revised this gist Jan 29, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Install VirtualBox 5.1 guest additions on Ubuntu server guest
    # Install VirtualBox 5.1/5.2 guest additions on Ubuntu server guest
    Have tested these instructions successfully under an Ubuntu 16.04LTS guest:

    - Create Ubuntu server instance under VirtualBox (obviously).
  5. @magnetikonline magnetikonline revised this gist Jan 8, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ Have tested these instructions successfully under an Ubuntu 16.04LTS guest:
    ```sh
    $ sudo su
    $ apt install gcc make
    $ mkdir -p /media/cdrom
    $ mkdir --parents /media/cdrom
    $ mount /dev/cdrom /media/cdrom
    $ /media/cdrom/VBoxLinuxAdditions.run
    $ reboot
    @@ -21,4 +21,4 @@ Have tested these instructions successfully under an Ubuntu 16.04LTS guest:
    ```

    - Host shares should now be mounted in Ubuntu guest under `/media` via the installed `VBoxService` service, set to start on system boot-up.
    - All done
    - All done.
  6. @magnetikonline magnetikonline revised this gist Dec 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # Install VirtualBox 5.1 guest additions on Ubuntu server guest
    Have tested these instructions successfully under Ubuntu 16.04LTS.
    Have tested these instructions successfully under an Ubuntu 16.04LTS guest:

    - Create Ubuntu server instance under VirtualBox (obviously).
    - Start VM, goto **Devices - Insert Guest Additions CD image** to mount the ISO image.
  7. @magnetikonline magnetikonline revised this gist Oct 30, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ Have tested these instructions successfully under Ubuntu 16.04LTS.
    - After reboot:

    ```sh
    $ usermod --append --groups vboxsf USERNAME
    $ sudo usermod --append --groups vboxsf USERNAME
    ```

    - Host shares should now be mounted in Ubuntu guest under `/media` via the installed `VBoxService` service, set to start on system boot-up.
  8. @magnetikonline magnetikonline created this gist Oct 27, 2016.
    24 changes: 24 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # Install VirtualBox 5.1 guest additions on Ubuntu server guest
    Have tested these instructions successfully under Ubuntu 16.04LTS.

    - Create Ubuntu server instance under VirtualBox (obviously).
    - Start VM, goto **Devices - Insert Guest Additions CD image** to mount the ISO image.
    - From the terminal, run the following commands:

    ```sh
    $ sudo su
    $ apt install gcc make
    $ mkdir -p /media/cdrom
    $ mount /dev/cdrom /media/cdrom
    $ /media/cdrom/VBoxLinuxAdditions.run
    $ reboot
    ```

    - After reboot:

    ```sh
    $ usermod --append --groups vboxsf USERNAME
    ```

    - Host shares should now be mounted in Ubuntu guest under `/media` via the installed `VBoxService` service, set to start on system boot-up.
    - All done