How to make Guest OS follow symlinks from shared folder












17















I have Ubuntu Desktop as my main OS and Ubuntu Server as my Guest OS in VirtualBox 4.2.16.



I created a shared folder called /shared and put in it several symlinks to different folders across my main OS. Of course, my guest OS sees only broken symlinks - because these locations exist only in the main OS.



How can I make my Guest OS see the actual content of them?



Creating another shared folder is not an option.










share|improve this question




















  • 1





    FYI if your host is windows7,8,10 then you need to follow the instructions in the answer AND then also sudo start the VM (aka "run as administrator") as seen in this blog post about linux guest VM shared folders with symlinks on windows host.

    – Trevor Boyd Smith
    Feb 14 '16 at 19:06
















17















I have Ubuntu Desktop as my main OS and Ubuntu Server as my Guest OS in VirtualBox 4.2.16.



I created a shared folder called /shared and put in it several symlinks to different folders across my main OS. Of course, my guest OS sees only broken symlinks - because these locations exist only in the main OS.



How can I make my Guest OS see the actual content of them?



Creating another shared folder is not an option.










share|improve this question




















  • 1





    FYI if your host is windows7,8,10 then you need to follow the instructions in the answer AND then also sudo start the VM (aka "run as administrator") as seen in this blog post about linux guest VM shared folders with symlinks on windows host.

    – Trevor Boyd Smith
    Feb 14 '16 at 19:06














17












17








17


9






I have Ubuntu Desktop as my main OS and Ubuntu Server as my Guest OS in VirtualBox 4.2.16.



I created a shared folder called /shared and put in it several symlinks to different folders across my main OS. Of course, my guest OS sees only broken symlinks - because these locations exist only in the main OS.



How can I make my Guest OS see the actual content of them?



Creating another shared folder is not an option.










share|improve this question
















I have Ubuntu Desktop as my main OS and Ubuntu Server as my Guest OS in VirtualBox 4.2.16.



I created a shared folder called /shared and put in it several symlinks to different folders across my main OS. Of course, my guest OS sees only broken symlinks - because these locations exist only in the main OS.



How can I make my Guest OS see the actual content of them?



Creating another shared folder is not an option.







virtualbox virtualization symbolic-link






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 17:45









clearkimura

3,86511954




3,86511954










asked Apr 11 '14 at 7:15









dev9dev9

215237




215237








  • 1





    FYI if your host is windows7,8,10 then you need to follow the instructions in the answer AND then also sudo start the VM (aka "run as administrator") as seen in this blog post about linux guest VM shared folders with symlinks on windows host.

    – Trevor Boyd Smith
    Feb 14 '16 at 19:06














  • 1





    FYI if your host is windows7,8,10 then you need to follow the instructions in the answer AND then also sudo start the VM (aka "run as administrator") as seen in this blog post about linux guest VM shared folders with symlinks on windows host.

    – Trevor Boyd Smith
    Feb 14 '16 at 19:06








1




1





FYI if your host is windows7,8,10 then you need to follow the instructions in the answer AND then also sudo start the VM (aka "run as administrator") as seen in this blog post about linux guest VM shared folders with symlinks on windows host.

– Trevor Boyd Smith
Feb 14 '16 at 19:06





FYI if your host is windows7,8,10 then you need to follow the instructions in the answer AND then also sudo start the VM (aka "run as administrator") as seen in this blog post about linux guest VM shared folders with symlinks on windows host.

– Trevor Boyd Smith
Feb 14 '16 at 19:06










2 Answers
2






active

oldest

votes


















23














It is a problem in virtualBox and has to do with security. Before 4.1.8 symlinks worked but was seriously flawed. And the discision was made to remove symlink support.



See this comment:



Symbolic link creation from within a guest has been disabled in VirtualBox 4.1.8 for security reasons. A guest could create symbolic links which point outside the assigned host directory. This has nothing to do with any ext3/ext4 bug. And the guest is still able to read symlinks which are created on the host.



Sorry for the late statement.



If you do



 VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1


Then your guest will be able to create symlinks again. But for security reasons (see above) this is disabled by default. The fix to prevent dangerous symlinks from the guest is very complicated, therefore we decided to not allow any guest to create any symlink to work around the security problem.



(I took the liberty to fix a bug in the comment ;) )




  • and also take note that you need to restart vBox for the change to activate.






share|improve this answer
























  • I executed this command and restarted VB. The color of the symlink has changed, but now I cannot even cd into it. I see it when I use ls, but bash stopped showing me it on TAB.

    – dev9
    Apr 11 '14 at 7:49











  • Hmm sounds like it is not executable?

    – Rinzwind
    Apr 11 '14 at 7:53











  • Well, ls shows me lrwxrwx---, so it should be fine. When I try to cd into it, bash tells me no such file or directory.

    – dev9
    Apr 11 '14 at 7:56






  • 3





    What is SHARE_NAME? Nobody explains it clearly where do we get it.

    – Meglio
    Jul 14 '15 at 12:21






  • 3





    The folder you use for the share.

    – Rinzwind
    Jul 14 '15 at 12:24



















0














Short answer is it cannot be done.



The following ticket on virtualbox.org has some clarification:




This change is intentional, and fixes a problem with the current
implementation of shared folders. For compatibility with guest OSes
which have no idea what a symlink is it is at the moment interpreted
on the host side, and this means one get unexpected behavior with
guest OSes which know what a symlink is (e.g. if a symlink on a shared
folder mounted at /foo would point to /bar/file it's impossible to do
the right thing on the host side).



It's of course fixable, but far from trivial as the separation of
symlink processing between guest OS side and host side needs to be
redesigned. This can't be done quickly, so the only option was to
disable symlink creation. Too many users/applications were caught by
surprise by the non-standard behavior.




Source






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f446317%2fhow-to-make-guest-os-follow-symlinks-from-shared-folder%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    23














    It is a problem in virtualBox and has to do with security. Before 4.1.8 symlinks worked but was seriously flawed. And the discision was made to remove symlink support.



    See this comment:



    Symbolic link creation from within a guest has been disabled in VirtualBox 4.1.8 for security reasons. A guest could create symbolic links which point outside the assigned host directory. This has nothing to do with any ext3/ext4 bug. And the guest is still able to read symlinks which are created on the host.



    Sorry for the late statement.



    If you do



     VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1


    Then your guest will be able to create symlinks again. But for security reasons (see above) this is disabled by default. The fix to prevent dangerous symlinks from the guest is very complicated, therefore we decided to not allow any guest to create any symlink to work around the security problem.



    (I took the liberty to fix a bug in the comment ;) )




    • and also take note that you need to restart vBox for the change to activate.






    share|improve this answer
























    • I executed this command and restarted VB. The color of the symlink has changed, but now I cannot even cd into it. I see it when I use ls, but bash stopped showing me it on TAB.

      – dev9
      Apr 11 '14 at 7:49











    • Hmm sounds like it is not executable?

      – Rinzwind
      Apr 11 '14 at 7:53











    • Well, ls shows me lrwxrwx---, so it should be fine. When I try to cd into it, bash tells me no such file or directory.

      – dev9
      Apr 11 '14 at 7:56






    • 3





      What is SHARE_NAME? Nobody explains it clearly where do we get it.

      – Meglio
      Jul 14 '15 at 12:21






    • 3





      The folder you use for the share.

      – Rinzwind
      Jul 14 '15 at 12:24
















    23














    It is a problem in virtualBox and has to do with security. Before 4.1.8 symlinks worked but was seriously flawed. And the discision was made to remove symlink support.



    See this comment:



    Symbolic link creation from within a guest has been disabled in VirtualBox 4.1.8 for security reasons. A guest could create symbolic links which point outside the assigned host directory. This has nothing to do with any ext3/ext4 bug. And the guest is still able to read symlinks which are created on the host.



    Sorry for the late statement.



    If you do



     VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1


    Then your guest will be able to create symlinks again. But for security reasons (see above) this is disabled by default. The fix to prevent dangerous symlinks from the guest is very complicated, therefore we decided to not allow any guest to create any symlink to work around the security problem.



    (I took the liberty to fix a bug in the comment ;) )




    • and also take note that you need to restart vBox for the change to activate.






    share|improve this answer
























    • I executed this command and restarted VB. The color of the symlink has changed, but now I cannot even cd into it. I see it when I use ls, but bash stopped showing me it on TAB.

      – dev9
      Apr 11 '14 at 7:49











    • Hmm sounds like it is not executable?

      – Rinzwind
      Apr 11 '14 at 7:53











    • Well, ls shows me lrwxrwx---, so it should be fine. When I try to cd into it, bash tells me no such file or directory.

      – dev9
      Apr 11 '14 at 7:56






    • 3





      What is SHARE_NAME? Nobody explains it clearly where do we get it.

      – Meglio
      Jul 14 '15 at 12:21






    • 3





      The folder you use for the share.

      – Rinzwind
      Jul 14 '15 at 12:24














    23












    23








    23







    It is a problem in virtualBox and has to do with security. Before 4.1.8 symlinks worked but was seriously flawed. And the discision was made to remove symlink support.



    See this comment:



    Symbolic link creation from within a guest has been disabled in VirtualBox 4.1.8 for security reasons. A guest could create symbolic links which point outside the assigned host directory. This has nothing to do with any ext3/ext4 bug. And the guest is still able to read symlinks which are created on the host.



    Sorry for the late statement.



    If you do



     VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1


    Then your guest will be able to create symlinks again. But for security reasons (see above) this is disabled by default. The fix to prevent dangerous symlinks from the guest is very complicated, therefore we decided to not allow any guest to create any symlink to work around the security problem.



    (I took the liberty to fix a bug in the comment ;) )




    • and also take note that you need to restart vBox for the change to activate.






    share|improve this answer













    It is a problem in virtualBox and has to do with security. Before 4.1.8 symlinks worked but was seriously flawed. And the discision was made to remove symlink support.



    See this comment:



    Symbolic link creation from within a guest has been disabled in VirtualBox 4.1.8 for security reasons. A guest could create symbolic links which point outside the assigned host directory. This has nothing to do with any ext3/ext4 bug. And the guest is still able to read symlinks which are created on the host.



    Sorry for the late statement.



    If you do



     VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1


    Then your guest will be able to create symlinks again. But for security reasons (see above) this is disabled by default. The fix to prevent dangerous symlinks from the guest is very complicated, therefore we decided to not allow any guest to create any symlink to work around the security problem.



    (I took the liberty to fix a bug in the comment ;) )




    • and also take note that you need to restart vBox for the change to activate.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 11 '14 at 7:35









    RinzwindRinzwind

    205k28391526




    205k28391526













    • I executed this command and restarted VB. The color of the symlink has changed, but now I cannot even cd into it. I see it when I use ls, but bash stopped showing me it on TAB.

      – dev9
      Apr 11 '14 at 7:49











    • Hmm sounds like it is not executable?

      – Rinzwind
      Apr 11 '14 at 7:53











    • Well, ls shows me lrwxrwx---, so it should be fine. When I try to cd into it, bash tells me no such file or directory.

      – dev9
      Apr 11 '14 at 7:56






    • 3





      What is SHARE_NAME? Nobody explains it clearly where do we get it.

      – Meglio
      Jul 14 '15 at 12:21






    • 3





      The folder you use for the share.

      – Rinzwind
      Jul 14 '15 at 12:24



















    • I executed this command and restarted VB. The color of the symlink has changed, but now I cannot even cd into it. I see it when I use ls, but bash stopped showing me it on TAB.

      – dev9
      Apr 11 '14 at 7:49











    • Hmm sounds like it is not executable?

      – Rinzwind
      Apr 11 '14 at 7:53











    • Well, ls shows me lrwxrwx---, so it should be fine. When I try to cd into it, bash tells me no such file or directory.

      – dev9
      Apr 11 '14 at 7:56






    • 3





      What is SHARE_NAME? Nobody explains it clearly where do we get it.

      – Meglio
      Jul 14 '15 at 12:21






    • 3





      The folder you use for the share.

      – Rinzwind
      Jul 14 '15 at 12:24

















    I executed this command and restarted VB. The color of the symlink has changed, but now I cannot even cd into it. I see it when I use ls, but bash stopped showing me it on TAB.

    – dev9
    Apr 11 '14 at 7:49





    I executed this command and restarted VB. The color of the symlink has changed, but now I cannot even cd into it. I see it when I use ls, but bash stopped showing me it on TAB.

    – dev9
    Apr 11 '14 at 7:49













    Hmm sounds like it is not executable?

    – Rinzwind
    Apr 11 '14 at 7:53





    Hmm sounds like it is not executable?

    – Rinzwind
    Apr 11 '14 at 7:53













    Well, ls shows me lrwxrwx---, so it should be fine. When I try to cd into it, bash tells me no such file or directory.

    – dev9
    Apr 11 '14 at 7:56





    Well, ls shows me lrwxrwx---, so it should be fine. When I try to cd into it, bash tells me no such file or directory.

    – dev9
    Apr 11 '14 at 7:56




    3




    3





    What is SHARE_NAME? Nobody explains it clearly where do we get it.

    – Meglio
    Jul 14 '15 at 12:21





    What is SHARE_NAME? Nobody explains it clearly where do we get it.

    – Meglio
    Jul 14 '15 at 12:21




    3




    3





    The folder you use for the share.

    – Rinzwind
    Jul 14 '15 at 12:24





    The folder you use for the share.

    – Rinzwind
    Jul 14 '15 at 12:24













    0














    Short answer is it cannot be done.



    The following ticket on virtualbox.org has some clarification:




    This change is intentional, and fixes a problem with the current
    implementation of shared folders. For compatibility with guest OSes
    which have no idea what a symlink is it is at the moment interpreted
    on the host side, and this means one get unexpected behavior with
    guest OSes which know what a symlink is (e.g. if a symlink on a shared
    folder mounted at /foo would point to /bar/file it's impossible to do
    the right thing on the host side).



    It's of course fixable, but far from trivial as the separation of
    symlink processing between guest OS side and host side needs to be
    redesigned. This can't be done quickly, so the only option was to
    disable symlink creation. Too many users/applications were caught by
    surprise by the non-standard behavior.




    Source






    share|improve this answer






























      0














      Short answer is it cannot be done.



      The following ticket on virtualbox.org has some clarification:




      This change is intentional, and fixes a problem with the current
      implementation of shared folders. For compatibility with guest OSes
      which have no idea what a symlink is it is at the moment interpreted
      on the host side, and this means one get unexpected behavior with
      guest OSes which know what a symlink is (e.g. if a symlink on a shared
      folder mounted at /foo would point to /bar/file it's impossible to do
      the right thing on the host side).



      It's of course fixable, but far from trivial as the separation of
      symlink processing between guest OS side and host side needs to be
      redesigned. This can't be done quickly, so the only option was to
      disable symlink creation. Too many users/applications were caught by
      surprise by the non-standard behavior.




      Source






      share|improve this answer




























        0












        0








        0







        Short answer is it cannot be done.



        The following ticket on virtualbox.org has some clarification:




        This change is intentional, and fixes a problem with the current
        implementation of shared folders. For compatibility with guest OSes
        which have no idea what a symlink is it is at the moment interpreted
        on the host side, and this means one get unexpected behavior with
        guest OSes which know what a symlink is (e.g. if a symlink on a shared
        folder mounted at /foo would point to /bar/file it's impossible to do
        the right thing on the host side).



        It's of course fixable, but far from trivial as the separation of
        symlink processing between guest OS side and host side needs to be
        redesigned. This can't be done quickly, so the only option was to
        disable symlink creation. Too many users/applications were caught by
        surprise by the non-standard behavior.




        Source






        share|improve this answer















        Short answer is it cannot be done.



        The following ticket on virtualbox.org has some clarification:




        This change is intentional, and fixes a problem with the current
        implementation of shared folders. For compatibility with guest OSes
        which have no idea what a symlink is it is at the moment interpreted
        on the host side, and this means one get unexpected behavior with
        guest OSes which know what a symlink is (e.g. if a symlink on a shared
        folder mounted at /foo would point to /bar/file it's impossible to do
        the right thing on the host side).



        It's of course fixable, but far from trivial as the separation of
        symlink processing between guest OS side and host side needs to be
        redesigned. This can't be done quickly, so the only option was to
        disable symlink creation. Too many users/applications were caught by
        surprise by the non-standard behavior.




        Source







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 20 '17 at 10:18









        Community

        1




        1










        answered Apr 11 '14 at 7:35









        Sylvain PineauSylvain Pineau

        48.6k16106150




        48.6k16106150






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f446317%2fhow-to-make-guest-os-follow-symlinks-from-shared-folder%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Ellipse (mathématiques)

            Quarter-circle Tiles

            Mont Emei