1

I am running Ubuntu Mate (16.04.3) on my raspi and I want to share a folder on my external HDD over the network via SMB. The filesystem on the HDD is NTFS. I have mounted the HDD to /media/myexthdd/ and I can access the files locally. Then I configured the smbd to share the directory /home/myusername/share. When I copy files in this folder I can access them remotely via SMB, so in general, smbd is working. Then I created a symlink /home/myusername/share/folder -> /media/myexthdd/folder. The symlink is valid and I can follow the symlink locally, but it is not shown when accessing the SMB. I already added the lines:

follow symlinks = yes
wide links = yes
unix extensions = no

in the [global] section of the smb.conf and I created another symlink /home/myusername/share/testfolder/ -> /home/myusername/testfolder for testing purpose. This symlink is also shown via SMB and I can follow the symlink and open the files in the symlinked folder. So I guess the problem lies somewhere in the way I mounted the NTFS? Btw the external NTFS is mounted by this command:

sudo /sbin/mount.ntfs /dev/sda1 /media/myexthdd -o rw,nodev,nosuid,uid=1000,gid=1000,uhelper=udisks2

All files and directories in the mounted fs have 777 permissions. So what has to be done so that the symlink to the NTFS is shown via SMB and so that I can access the symlink to the NTFS via SMB?

0

You can't share directory trees outside of those that are explicitly shared. Pointing a symbolic link from the latter to the former won't work; if it did, anybody with write privileges on the network share could create a symbolic link to access directories that should stay inaccessible to her.

You need to either share the directory tree on the external drive through an explicit network share or turn the directory structure on the external drive into a sub-tree of an existing network share by mounting it there. You can use bind mounts if you don't want to mount the entire drive there (see the section “The bind mounts” of man mount).

| improve this answer | |
  • Hey! Thank you for your answer. I think this is not completly true, because I can share a whole directory tree via a symlink as I mentioned in my question. I think that is what `follow symlinks´ option is for. But when I try to set a symlink on a directory on my NTFS drive and put that symlink in my shared folder, the symlink isn't shared at all and this must have something to do with NTFS/the way I mount the NTFS. – noobie Jan 13 '18 at 14:53
  • But I also tried mount --bind and mounted the folder from my NTFS-HDD that I wanted to share into a directory inside my shared folder and it works! So thank you! But I am still curious why it also works with symlinks, when the symlink points to a file or directory on my (internal) etx4 filesystem and why it does not work if the symlink points to a file or directory on my (external) NTFS filesystem... – noobie Jan 13 '18 at 15:05
  • @noobie: Is the target of the working symlink reachable through the same or another network share without symlinks? – David Foerster Jan 13 '18 at 18:17
  • In any case, as you’ve never accepted an answer before: if this answers your question, don’t forget to click the grey ☑ under the number at the left of this text to accept it, which means “yes, this answer is valid”! – David Foerster Jan 13 '18 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.