TL;DR
On Ubuntu Server, without guest additions, manually mount the shared folder on the guest, e.g.:
mkdir /mnt/sharedfolder
sudo mount -t vboxsf FolderNameInVBoxSettings /mnt/sharedfolder
If the above works fine, add a corresponding entry in /etc/fstab
to make it permanent.
Detailed Intructions
Let me share what has worked for me in two different setups, an Ubuntu 20.04 LTS Desktop and an Ubuntu 20.04.3 LTS Server on a Windows 10 host. I will use an example username sun
. The first step is common, and is done via the VirtualBox UI (I have 6.1.26 at the time of posting), by selecting the target VM and going to Settings > Shared Folders and clicking the "Add shared folder" button:

On the dialog box, I entered the Windows source path in "Folder Path", an arbitrary name for the shared folder under "Folder Name", and the "Mount Point" which is a valid path of my choosing, on the guest. Note that "somename" should be an empty directory:

For Ubuntu Desktop
For a desktop, I also ticked the "Auto-mount" option above. Assuming that guest additions have already been installed, and that the somename
directory exists, then that's all there is to it. The shared folder will be visible, even on reboot.
To avoid having to use sudo
every time to access the shared folder, I did one more thing:
sudo adduser sun vboxsf
For Ubuntu Server
For the server, without guest additions installed, I took note of the ArbitraryName above, because I will need to use the same name for the mount command on the Linux guest:
mkdir /home/sun/somename
sudo mount -t vboxsf ArbitraryName /home/sun/somename
I check that I can see the files:
cd /home/sun/somename
ls
Yes, the Windows files are there! But this mount will be lost on reboot, so I make it permanent by adding an entry to /etc/fstab
:
$ sudo vim /etc/fstab
# My VirtualBox shared folder entry in /etc/fstab
ArbitraryName /home/sun/somename vboxsf defaults 0 0
Again, ArbitraryName
must be the same one specified in VirtualBox settings, i.e. the same one we used in the previous mount
test command. Now I can reboot the machine and after login, I can do ls /home/sun/somename
to see my Windows shared folder files! As a bonus, I didn't like the green highlight on the shared folder directories, so I added the following to my ~/.bashrc
:
export LS_COLORS=$LS_COLORS:'ow=1;34:';
The above gets rid of that highlighting but still keeps the other colors, such as blue for directories. Hope this is helpful!