Symbolic links in shared folders were disabled on VirtualBox for security reasons. If you are sure the symlinks in your shared folder will not pose a security problem, you can enable them like this:
1. Run the VirtualBox as administrator on Windows.
For me, this was the only way to avoid symbolic link creation errors like:
ln: failed to create symbolic link ‘/opt/projects/myproject/test2.txt’: Operation not permitted
(source)
Please notice: Maybe on your versions of Windows and VirtualBox this problem was solved already. And you do not need to run the VirtualBox as administrator.
I had this problem on Windows 10 Pro Build 19045.4651, VirtualBox v. 7.0.14.
After your symlink gets created, you can run the VirtualBox not as an administrator again. The already existing symbolic links kept working for me.
2. Get the name of your shared folder:
3. On Windows in the terminal:
Go to the folder where the VirtualBox is installed. And list the virtual machines:
cd C:\Program Files\Oracle\VirtualBox\ VBoxManage list vms
4. In the same folder run the command:
VBoxManage.exe setextradata "Virtual_Machine_Name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/Shared_Folder_Name 1
(source)
For example, in my case the VM name was “wpd_22_04 88” and the shared folder name (see item #2 above) was “projects”. So the command was:
VBoxManage.exe setextradata "wpd_22_04 88" VBoxInternal2/SharedFoldersEnableSymlinksCreate/projects 1
5. Try to create some symlink in your VM terminal to make sure it is possible:
sudo ln -s /opt/projects/myproject/test1.txt /opt/projects/myproject/test2.txt
Please notice: You can find detailed information on sharing a folder to VirtualBox using Guest Additions in this article.