How do you make samba follow symlink outside the shared path












47














This is Ubuntu server 10.04 64 and samba 3.4.7.



I have a shared directory /home/mit/share and another one /home/temp that I link into the shared one:



ln -s /home/temp /home/mit/share/temp


But on windows, after using internet, I cannot open S:/temp, but on Linux it is possible to access /home/mit/share/temp like expected.



This works if I link directories inside /home/mit/share/temp, so I guess samba is restricting to jump with a link outside/above the shared directory.



EDIT:



See also this question titled Ubuntu + latest samba version, symlinks no longer work on share mounted in Windows.



It seems best to put unix extensions = no into the global section and follow symlinks = yes and wide links = yes only into the shares section, where you really need it.



The unix extension flag has to live in the global section and not in the individual shares sections. But for security reasons it is better to use the other options only where you need it, and not globally.










share|improve this question
























  • Can you try a hardlink instead of a symlink?
    – Falmarri
    Jan 3 '11 at 3:54
















47














This is Ubuntu server 10.04 64 and samba 3.4.7.



I have a shared directory /home/mit/share and another one /home/temp that I link into the shared one:



ln -s /home/temp /home/mit/share/temp


But on windows, after using internet, I cannot open S:/temp, but on Linux it is possible to access /home/mit/share/temp like expected.



This works if I link directories inside /home/mit/share/temp, so I guess samba is restricting to jump with a link outside/above the shared directory.



EDIT:



See also this question titled Ubuntu + latest samba version, symlinks no longer work on share mounted in Windows.



It seems best to put unix extensions = no into the global section and follow symlinks = yes and wide links = yes only into the shares section, where you really need it.



The unix extension flag has to live in the global section and not in the individual shares sections. But for security reasons it is better to use the other options only where you need it, and not globally.










share|improve this question
























  • Can you try a hardlink instead of a symlink?
    – Falmarri
    Jan 3 '11 at 3:54














47












47








47


29





This is Ubuntu server 10.04 64 and samba 3.4.7.



I have a shared directory /home/mit/share and another one /home/temp that I link into the shared one:



ln -s /home/temp /home/mit/share/temp


But on windows, after using internet, I cannot open S:/temp, but on Linux it is possible to access /home/mit/share/temp like expected.



This works if I link directories inside /home/mit/share/temp, so I guess samba is restricting to jump with a link outside/above the shared directory.



EDIT:



See also this question titled Ubuntu + latest samba version, symlinks no longer work on share mounted in Windows.



It seems best to put unix extensions = no into the global section and follow symlinks = yes and wide links = yes only into the shares section, where you really need it.



The unix extension flag has to live in the global section and not in the individual shares sections. But for security reasons it is better to use the other options only where you need it, and not globally.










share|improve this question















This is Ubuntu server 10.04 64 and samba 3.4.7.



I have a shared directory /home/mit/share and another one /home/temp that I link into the shared one:



ln -s /home/temp /home/mit/share/temp


But on windows, after using internet, I cannot open S:/temp, but on Linux it is possible to access /home/mit/share/temp like expected.



This works if I link directories inside /home/mit/share/temp, so I guess samba is restricting to jump with a link outside/above the shared directory.



EDIT:



See also this question titled Ubuntu + latest samba version, symlinks no longer work on share mounted in Windows.



It seems best to put unix extensions = no into the global section and follow symlinks = yes and wide links = yes only into the shares section, where you really need it.



The unix extension flag has to live in the global section and not in the individual shares sections. But for security reasons it is better to use the other options only where you need it, and not globally.







filesystems windows symlink samba






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 20 '17 at 10:18









Community

1




1










asked Dec 24 '10 at 3:23









mitmit

5622714




5622714












  • Can you try a hardlink instead of a symlink?
    – Falmarri
    Jan 3 '11 at 3:54


















  • Can you try a hardlink instead of a symlink?
    – Falmarri
    Jan 3 '11 at 3:54
















Can you try a hardlink instead of a symlink?
– Falmarri
Jan 3 '11 at 3:54




Can you try a hardlink instead of a symlink?
– Falmarri
Jan 3 '11 at 3:54










5 Answers
5






active

oldest

votes


















73














Edit smb.conf



[global]
unix extensions = no

[share]
follow symlinks = yes
wide links = yes


Note: If you're using a newer version of samba the following may work for you instead:



[global]
allow insecure wide links = yes

[share]
follow symlinks = yes
wide links = yes


documentation on follow symlinks and wide links flags: https://www.samba.org/samba/docs/using_samba/ch08.html#samba2-CHP-8-TABLE-1






share|improve this answer























  • See also the explanation at the end of the question above why this is a good solution.
    – mit
    Jun 18 '14 at 16:44










  • In case, somebody else struggles with all those commentary obfuscating this rather short file: copy to a backup, and re-create filtered: 1: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2: grep -o '^[^#;]*' smb.conf.bak >smb.conf
    – Frank Nocke
    Sep 26 '16 at 7:24










  • does [share] mean [<share_name>]?
    – neckTwi
    Aug 4 '18 at 8:24










  • @neckTwi - That's what I assumed, and it worked for me.
    – Geoff
    Aug 13 '18 at 21:47










  • @Geoff That didn't work for me! switched to sshfs
    – neckTwi
    Aug 14 '18 at 2:29





















8














Greetings, I've tried putting this into configuration to fix symlinks for windows for my setup , but I am not sure if it will affect windows client, otherwise it follows symlinks when I connect to this box.



[global]                                                                        
unix extensions = no





share|improve this answer























  • Qiqi's answer agrees with this one: superuser.com/questions/128716/…
    – Janus
    Jan 3 '11 at 4:49












  • Yes, this definitely fixes the issue in my environment.
    – TML
    Jul 28 '11 at 16:49



















8














Alternatively to the other answers, to keep the unix extensions enabled, it is possible to use:



[global]
allow insecure wide links = yes

[share]
follow symlinks = yes
wide links = yes





share|improve this answer





















  • does [share] mean [<share_name>]?
    – neckTwi
    Aug 4 '18 at 8:23










  • Yes, it can be any smb.conf section that 'describes a shared resource (known as a “share”)' (quoted from the documentation). It may be also in a special section [homes], where I use it. See the documentation for details.
    – user1182474
    Aug 4 '18 at 13:05





















3














To allow Samba clients to follow symlinks outside of the shared path, all you need in the Samba configuration is :



[global]
allow insecure wide links = yes
unix extensions = no

[myShare]
wide links = yes


(in addition to the Samba shares definitions themselves, of course). This is -theoretically- enough for *nix clients.



NB : The "follow symlinks" directive is not necessary as it defaults to "yes"



As for Windows clients, 1 setting is still missing to let them follow such links.
To do so :




  1. open a Windows shell having Administrator privileges


  2. run :



    fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1


  3. reboot to reload settings



NB : the same result can be obtaind by editing the Windows registry. See links below



sources :




  • https://nim-labs.com/enabling-windows-recognize-symbolic-links/

  • https://stackoverflow.com/questions/229643/how-do-i-overcome-the-the-symbolic-link-cannot-be-followed-because-its-type-is#answer-230047






share|improve this answer





























    0














    You may need to address more than just the Samba configuration file if you are running AppArmor.



    You do need the following directives in your smb.conf:



    follow symlinks = yes
    wide links = yes
    unix extensions = no
    # No need for "allow insecure wide links" unless you want "unix extensions = yes"


    But, AppArmor blocks access to parts of the file system according to its own ruleset semantics. So, if your symlink within Samba pointed to a location which AppArmor would block, Samba would deny access.



    On my system, Samba updates AppArmor profiles on the service start/stop, so I could change an AppArmor profile, but risk Samba or another program overwriting it. Instead, I decided to create an inaccessible share in Samba referencing the location which contained the symlink target I wanted to access (still in smb.conf):



    # The following is a hack for AppArmor to allow the path
    [share1 for AppArmor] # Or whichever name you choose
    browseable = no
    path = /home # Point to directory or parent directory of the location to access
    read only = yes
    guest ok = no
    valid users = none




    share





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      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: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f5120%2fhow-do-you-make-samba-follow-symlink-outside-the-shared-path%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      73














      Edit smb.conf



      [global]
      unix extensions = no

      [share]
      follow symlinks = yes
      wide links = yes


      Note: If you're using a newer version of samba the following may work for you instead:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes


      documentation on follow symlinks and wide links flags: https://www.samba.org/samba/docs/using_samba/ch08.html#samba2-CHP-8-TABLE-1






      share|improve this answer























      • See also the explanation at the end of the question above why this is a good solution.
        – mit
        Jun 18 '14 at 16:44










      • In case, somebody else struggles with all those commentary obfuscating this rather short file: copy to a backup, and re-create filtered: 1: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2: grep -o '^[^#;]*' smb.conf.bak >smb.conf
        – Frank Nocke
        Sep 26 '16 at 7:24










      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:24










      • @neckTwi - That's what I assumed, and it worked for me.
        – Geoff
        Aug 13 '18 at 21:47










      • @Geoff That didn't work for me! switched to sshfs
        – neckTwi
        Aug 14 '18 at 2:29


















      73














      Edit smb.conf



      [global]
      unix extensions = no

      [share]
      follow symlinks = yes
      wide links = yes


      Note: If you're using a newer version of samba the following may work for you instead:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes


      documentation on follow symlinks and wide links flags: https://www.samba.org/samba/docs/using_samba/ch08.html#samba2-CHP-8-TABLE-1






      share|improve this answer























      • See also the explanation at the end of the question above why this is a good solution.
        – mit
        Jun 18 '14 at 16:44










      • In case, somebody else struggles with all those commentary obfuscating this rather short file: copy to a backup, and re-create filtered: 1: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2: grep -o '^[^#;]*' smb.conf.bak >smb.conf
        – Frank Nocke
        Sep 26 '16 at 7:24










      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:24










      • @neckTwi - That's what I assumed, and it worked for me.
        – Geoff
        Aug 13 '18 at 21:47










      • @Geoff That didn't work for me! switched to sshfs
        – neckTwi
        Aug 14 '18 at 2:29
















      73












      73








      73






      Edit smb.conf



      [global]
      unix extensions = no

      [share]
      follow symlinks = yes
      wide links = yes


      Note: If you're using a newer version of samba the following may work for you instead:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes


      documentation on follow symlinks and wide links flags: https://www.samba.org/samba/docs/using_samba/ch08.html#samba2-CHP-8-TABLE-1






      share|improve this answer














      Edit smb.conf



      [global]
      unix extensions = no

      [share]
      follow symlinks = yes
      wide links = yes


      Note: If you're using a newer version of samba the following may work for you instead:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes


      documentation on follow symlinks and wide links flags: https://www.samba.org/samba/docs/using_samba/ch08.html#samba2-CHP-8-TABLE-1







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 6 '17 at 17:56









      Pete

      219210




      219210










      answered Jun 15 '14 at 4:51









      MaheshMahesh

      74663




      74663












      • See also the explanation at the end of the question above why this is a good solution.
        – mit
        Jun 18 '14 at 16:44










      • In case, somebody else struggles with all those commentary obfuscating this rather short file: copy to a backup, and re-create filtered: 1: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2: grep -o '^[^#;]*' smb.conf.bak >smb.conf
        – Frank Nocke
        Sep 26 '16 at 7:24










      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:24










      • @neckTwi - That's what I assumed, and it worked for me.
        – Geoff
        Aug 13 '18 at 21:47










      • @Geoff That didn't work for me! switched to sshfs
        – neckTwi
        Aug 14 '18 at 2:29




















      • See also the explanation at the end of the question above why this is a good solution.
        – mit
        Jun 18 '14 at 16:44










      • In case, somebody else struggles with all those commentary obfuscating this rather short file: copy to a backup, and re-create filtered: 1: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2: grep -o '^[^#;]*' smb.conf.bak >smb.conf
        – Frank Nocke
        Sep 26 '16 at 7:24










      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:24










      • @neckTwi - That's what I assumed, and it worked for me.
        – Geoff
        Aug 13 '18 at 21:47










      • @Geoff That didn't work for me! switched to sshfs
        – neckTwi
        Aug 14 '18 at 2:29


















      See also the explanation at the end of the question above why this is a good solution.
      – mit
      Jun 18 '14 at 16:44




      See also the explanation at the end of the question above why this is a good solution.
      – mit
      Jun 18 '14 at 16:44












      In case, somebody else struggles with all those commentary obfuscating this rather short file: copy to a backup, and re-create filtered: 1: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2: grep -o '^[^#;]*' smb.conf.bak >smb.conf
      – Frank Nocke
      Sep 26 '16 at 7:24




      In case, somebody else struggles with all those commentary obfuscating this rather short file: copy to a backup, and re-create filtered: 1: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2: grep -o '^[^#;]*' smb.conf.bak >smb.conf
      – Frank Nocke
      Sep 26 '16 at 7:24












      does [share] mean [<share_name>]?
      – neckTwi
      Aug 4 '18 at 8:24




      does [share] mean [<share_name>]?
      – neckTwi
      Aug 4 '18 at 8:24












      @neckTwi - That's what I assumed, and it worked for me.
      – Geoff
      Aug 13 '18 at 21:47




      @neckTwi - That's what I assumed, and it worked for me.
      – Geoff
      Aug 13 '18 at 21:47












      @Geoff That didn't work for me! switched to sshfs
      – neckTwi
      Aug 14 '18 at 2:29






      @Geoff That didn't work for me! switched to sshfs
      – neckTwi
      Aug 14 '18 at 2:29















      8














      Greetings, I've tried putting this into configuration to fix symlinks for windows for my setup , but I am not sure if it will affect windows client, otherwise it follows symlinks when I connect to this box.



      [global]                                                                        
      unix extensions = no





      share|improve this answer























      • Qiqi's answer agrees with this one: superuser.com/questions/128716/…
        – Janus
        Jan 3 '11 at 4:49












      • Yes, this definitely fixes the issue in my environment.
        – TML
        Jul 28 '11 at 16:49
















      8














      Greetings, I've tried putting this into configuration to fix symlinks for windows for my setup , but I am not sure if it will affect windows client, otherwise it follows symlinks when I connect to this box.



      [global]                                                                        
      unix extensions = no





      share|improve this answer























      • Qiqi's answer agrees with this one: superuser.com/questions/128716/…
        – Janus
        Jan 3 '11 at 4:49












      • Yes, this definitely fixes the issue in my environment.
        – TML
        Jul 28 '11 at 16:49














      8












      8








      8






      Greetings, I've tried putting this into configuration to fix symlinks for windows for my setup , but I am not sure if it will affect windows client, otherwise it follows symlinks when I connect to this box.



      [global]                                                                        
      unix extensions = no





      share|improve this answer














      Greetings, I've tried putting this into configuration to fix symlinks for windows for my setup , but I am not sure if it will affect windows client, otherwise it follows symlinks when I connect to this box.



      [global]                                                                        
      unix extensions = no






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 3 '11 at 18:25









      Michael Mrozek

      60.7k29187208




      60.7k29187208










      answered Jan 2 '11 at 23:40









      QiqiQiqi

      23613




      23613












      • Qiqi's answer agrees with this one: superuser.com/questions/128716/…
        – Janus
        Jan 3 '11 at 4:49












      • Yes, this definitely fixes the issue in my environment.
        – TML
        Jul 28 '11 at 16:49


















      • Qiqi's answer agrees with this one: superuser.com/questions/128716/…
        – Janus
        Jan 3 '11 at 4:49












      • Yes, this definitely fixes the issue in my environment.
        – TML
        Jul 28 '11 at 16:49
















      Qiqi's answer agrees with this one: superuser.com/questions/128716/…
      – Janus
      Jan 3 '11 at 4:49






      Qiqi's answer agrees with this one: superuser.com/questions/128716/…
      – Janus
      Jan 3 '11 at 4:49














      Yes, this definitely fixes the issue in my environment.
      – TML
      Jul 28 '11 at 16:49




      Yes, this definitely fixes the issue in my environment.
      – TML
      Jul 28 '11 at 16:49











      8














      Alternatively to the other answers, to keep the unix extensions enabled, it is possible to use:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes





      share|improve this answer





















      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:23










      • Yes, it can be any smb.conf section that 'describes a shared resource (known as a “share”)' (quoted from the documentation). It may be also in a special section [homes], where I use it. See the documentation for details.
        – user1182474
        Aug 4 '18 at 13:05


















      8














      Alternatively to the other answers, to keep the unix extensions enabled, it is possible to use:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes





      share|improve this answer





















      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:23










      • Yes, it can be any smb.conf section that 'describes a shared resource (known as a “share”)' (quoted from the documentation). It may be also in a special section [homes], where I use it. See the documentation for details.
        – user1182474
        Aug 4 '18 at 13:05
















      8












      8








      8






      Alternatively to the other answers, to keep the unix extensions enabled, it is possible to use:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes





      share|improve this answer












      Alternatively to the other answers, to keep the unix extensions enabled, it is possible to use:



      [global]
      allow insecure wide links = yes

      [share]
      follow symlinks = yes
      wide links = yes






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jul 31 '16 at 19:27









      user1182474user1182474

      19113




      19113












      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:23










      • Yes, it can be any smb.conf section that 'describes a shared resource (known as a “share”)' (quoted from the documentation). It may be also in a special section [homes], where I use it. See the documentation for details.
        – user1182474
        Aug 4 '18 at 13:05




















      • does [share] mean [<share_name>]?
        – neckTwi
        Aug 4 '18 at 8:23










      • Yes, it can be any smb.conf section that 'describes a shared resource (known as a “share”)' (quoted from the documentation). It may be also in a special section [homes], where I use it. See the documentation for details.
        – user1182474
        Aug 4 '18 at 13:05


















      does [share] mean [<share_name>]?
      – neckTwi
      Aug 4 '18 at 8:23




      does [share] mean [<share_name>]?
      – neckTwi
      Aug 4 '18 at 8:23












      Yes, it can be any smb.conf section that 'describes a shared resource (known as a “share”)' (quoted from the documentation). It may be also in a special section [homes], where I use it. See the documentation for details.
      – user1182474
      Aug 4 '18 at 13:05






      Yes, it can be any smb.conf section that 'describes a shared resource (known as a “share”)' (quoted from the documentation). It may be also in a special section [homes], where I use it. See the documentation for details.
      – user1182474
      Aug 4 '18 at 13:05













      3














      To allow Samba clients to follow symlinks outside of the shared path, all you need in the Samba configuration is :



      [global]
      allow insecure wide links = yes
      unix extensions = no

      [myShare]
      wide links = yes


      (in addition to the Samba shares definitions themselves, of course). This is -theoretically- enough for *nix clients.



      NB : The "follow symlinks" directive is not necessary as it defaults to "yes"



      As for Windows clients, 1 setting is still missing to let them follow such links.
      To do so :




      1. open a Windows shell having Administrator privileges


      2. run :



        fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1


      3. reboot to reload settings



      NB : the same result can be obtaind by editing the Windows registry. See links below



      sources :




      • https://nim-labs.com/enabling-windows-recognize-symbolic-links/

      • https://stackoverflow.com/questions/229643/how-do-i-overcome-the-the-symbolic-link-cannot-be-followed-because-its-type-is#answer-230047






      share|improve this answer


























        3














        To allow Samba clients to follow symlinks outside of the shared path, all you need in the Samba configuration is :



        [global]
        allow insecure wide links = yes
        unix extensions = no

        [myShare]
        wide links = yes


        (in addition to the Samba shares definitions themselves, of course). This is -theoretically- enough for *nix clients.



        NB : The "follow symlinks" directive is not necessary as it defaults to "yes"



        As for Windows clients, 1 setting is still missing to let them follow such links.
        To do so :




        1. open a Windows shell having Administrator privileges


        2. run :



          fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1


        3. reboot to reload settings



        NB : the same result can be obtaind by editing the Windows registry. See links below



        sources :




        • https://nim-labs.com/enabling-windows-recognize-symbolic-links/

        • https://stackoverflow.com/questions/229643/how-do-i-overcome-the-the-symbolic-link-cannot-be-followed-because-its-type-is#answer-230047






        share|improve this answer
























          3












          3








          3






          To allow Samba clients to follow symlinks outside of the shared path, all you need in the Samba configuration is :



          [global]
          allow insecure wide links = yes
          unix extensions = no

          [myShare]
          wide links = yes


          (in addition to the Samba shares definitions themselves, of course). This is -theoretically- enough for *nix clients.



          NB : The "follow symlinks" directive is not necessary as it defaults to "yes"



          As for Windows clients, 1 setting is still missing to let them follow such links.
          To do so :




          1. open a Windows shell having Administrator privileges


          2. run :



            fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1


          3. reboot to reload settings



          NB : the same result can be obtaind by editing the Windows registry. See links below



          sources :




          • https://nim-labs.com/enabling-windows-recognize-symbolic-links/

          • https://stackoverflow.com/questions/229643/how-do-i-overcome-the-the-symbolic-link-cannot-be-followed-because-its-type-is#answer-230047






          share|improve this answer












          To allow Samba clients to follow symlinks outside of the shared path, all you need in the Samba configuration is :



          [global]
          allow insecure wide links = yes
          unix extensions = no

          [myShare]
          wide links = yes


          (in addition to the Samba shares definitions themselves, of course). This is -theoretically- enough for *nix clients.



          NB : The "follow symlinks" directive is not necessary as it defaults to "yes"



          As for Windows clients, 1 setting is still missing to let them follow such links.
          To do so :




          1. open a Windows shell having Administrator privileges


          2. run :



            fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1


          3. reboot to reload settings



          NB : the same result can be obtaind by editing the Windows registry. See links below



          sources :




          • https://nim-labs.com/enabling-windows-recognize-symbolic-links/

          • https://stackoverflow.com/questions/229643/how-do-i-overcome-the-the-symbolic-link-cannot-be-followed-because-its-type-is#answer-230047







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 11 '18 at 13:52









          HttqmHttqm

          463




          463























              0














              You may need to address more than just the Samba configuration file if you are running AppArmor.



              You do need the following directives in your smb.conf:



              follow symlinks = yes
              wide links = yes
              unix extensions = no
              # No need for "allow insecure wide links" unless you want "unix extensions = yes"


              But, AppArmor blocks access to parts of the file system according to its own ruleset semantics. So, if your symlink within Samba pointed to a location which AppArmor would block, Samba would deny access.



              On my system, Samba updates AppArmor profiles on the service start/stop, so I could change an AppArmor profile, but risk Samba or another program overwriting it. Instead, I decided to create an inaccessible share in Samba referencing the location which contained the symlink target I wanted to access (still in smb.conf):



              # The following is a hack for AppArmor to allow the path
              [share1 for AppArmor] # Or whichever name you choose
              browseable = no
              path = /home # Point to directory or parent directory of the location to access
              read only = yes
              guest ok = no
              valid users = none




              share


























                0














                You may need to address more than just the Samba configuration file if you are running AppArmor.



                You do need the following directives in your smb.conf:



                follow symlinks = yes
                wide links = yes
                unix extensions = no
                # No need for "allow insecure wide links" unless you want "unix extensions = yes"


                But, AppArmor blocks access to parts of the file system according to its own ruleset semantics. So, if your symlink within Samba pointed to a location which AppArmor would block, Samba would deny access.



                On my system, Samba updates AppArmor profiles on the service start/stop, so I could change an AppArmor profile, but risk Samba or another program overwriting it. Instead, I decided to create an inaccessible share in Samba referencing the location which contained the symlink target I wanted to access (still in smb.conf):



                # The following is a hack for AppArmor to allow the path
                [share1 for AppArmor] # Or whichever name you choose
                browseable = no
                path = /home # Point to directory or parent directory of the location to access
                read only = yes
                guest ok = no
                valid users = none




                share
























                  0












                  0








                  0






                  You may need to address more than just the Samba configuration file if you are running AppArmor.



                  You do need the following directives in your smb.conf:



                  follow symlinks = yes
                  wide links = yes
                  unix extensions = no
                  # No need for "allow insecure wide links" unless you want "unix extensions = yes"


                  But, AppArmor blocks access to parts of the file system according to its own ruleset semantics. So, if your symlink within Samba pointed to a location which AppArmor would block, Samba would deny access.



                  On my system, Samba updates AppArmor profiles on the service start/stop, so I could change an AppArmor profile, but risk Samba or another program overwriting it. Instead, I decided to create an inaccessible share in Samba referencing the location which contained the symlink target I wanted to access (still in smb.conf):



                  # The following is a hack for AppArmor to allow the path
                  [share1 for AppArmor] # Or whichever name you choose
                  browseable = no
                  path = /home # Point to directory or parent directory of the location to access
                  read only = yes
                  guest ok = no
                  valid users = none




                  share












                  You may need to address more than just the Samba configuration file if you are running AppArmor.



                  You do need the following directives in your smb.conf:



                  follow symlinks = yes
                  wide links = yes
                  unix extensions = no
                  # No need for "allow insecure wide links" unless you want "unix extensions = yes"


                  But, AppArmor blocks access to parts of the file system according to its own ruleset semantics. So, if your symlink within Samba pointed to a location which AppArmor would block, Samba would deny access.



                  On my system, Samba updates AppArmor profiles on the service start/stop, so I could change an AppArmor profile, but risk Samba or another program overwriting it. Instead, I decided to create an inaccessible share in Samba referencing the location which contained the symlink target I wanted to access (still in smb.conf):



                  # The following is a hack for AppArmor to allow the path
                  [share1 for AppArmor] # Or whichever name you choose
                  browseable = no
                  path = /home # Point to directory or parent directory of the location to access
                  read only = yes
                  guest ok = no
                  valid users = none





                  share











                  share


                  share










                  answered 3 mins ago









                  palswimpalswim

                  1,59611732




                  1,59611732






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2funix.stackexchange.com%2fquestions%2f5120%2fhow-do-you-make-samba-follow-symlink-outside-the-shared-path%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

                      CARDNET

                      Boot-repair Failure: Unable to locate package grub-common:i386

                      濃尾地震