May 30, 20251 yr I'm migrating a Windows server's sharing environment to Unraid (7.0.1 currently) Windows allows any folder to be shared as a unique network share name regardless of whether the whole drive is also shared. I want to match the structure and contents of the shares so the client systems will be able to easily migrate to the Unraid server. Here's one example of a nested sharing structure. I have copied the Windows D drive to a share on Unraid called d-root. It contains some directories that need to be shared also. d-root (shared as d) IMAGES (shared as IMAGES) IFL_temp (shared as IFL_temp)It turns out this is non-obvious to do on Unraid. I puzzeled over the Add Shares page for a while, and then started searching. I found a thread here that explains how to do it with symlinks. Thanks to @Frank1940 for the help!However I'm finding it doesn't work quite as expected. I follow this process:1) Using the Unraid GUI for Shares, create a new share for IMAGES2) Verify that /mnt/user/IMAGES has been created.3) issue the command from Unraid terminal: ln -s /mnt/user/d-root/IMAGES /mnt/user/IMAGESI was expecting that the contents of /mnt/user/d-root/IMAGES would appear in /mnt/user/IMAGESWhat happens is that /mnt/user/IMAGES contains IMAGES@ which is the link:root@T440:/mnt/user/IMAGES# ls -ltotal 0lrwxrwxrwx 1 root root 18 May 30 16:59 IMAGES -> /mnt/user/d-root/IMAGES/From a client on the network, the share "IMAGES " contains a single directory "IMAGES" which then contains the expected contents of IMAGES.How can I make the contents of /mnt/user/d-root/IMAGES appear as the content of the network share called IMAGES ?
May 31, 20251 yr Community Expert Look at the following screenshot:Notice that before the first tick, that there is no trailing forward-slash after the "I".Notice that before the second tick, that there is a trailing forward-slash after the "I".Many times it makes no difference whether it is there or not. But, in this case, it does! Without the trailing slash, the command displays the the Symlink path and the actual file location. With the trailing slash present, it shows the contents of root of the Symlink. (By the way, I always use the -a switch with ls because it will display everything. Unlike Windows, I usually use the complete Linux path starting from the root of the OS. It involves a bit of extra typing in some cases. I will point out that the Shell has a whole set of editing and the arrow-keys form the strating. Up and down will take you through the command in the stack. Left and right and delete will allow you to edit the command!
May 31, 20251 yr Author Thanks! I first removed the previous symlink and re-created with the trailing slash on the first path (the target) .I may have additional complications because the share created in unraid GUI is /mnt/user/images, but the folder I'm trying to share is /mnt/user/d-root/IMAGES/I unlinked the previous share and tried again like this:root@T440:/mnt/user/images# lsroot@T440:/mnt/user/images# ln -s /mnt/user/d-root/IMAGES/ /mnt/user/imagesroot@T440:/mnt/user/images# ls -altotal 0drwxrwxrwx 1 nobody users 28 May 31 10:51 ./drwxrwxrwx 1 nobody users 88 May 31 10:50 ../lrwxrwxrwx 1 root root 19 May 31 10:51 IMAGES -> /mnt/user/d-root/IMAGES//This still results in the network share "images" containing a single directory "IMAGES".I want the share to show the content of /mnt/user/d-root/IMAGES/Edit - I also tried the trailing / on the symlink path but not the target:root@T440:/mnt/user/images# ln -s /mnt/user/d-root/IMAGES /mnt/user/images/root@T440:/mnt/user/images# ls -altotal 0drwxrwxrwx 1 nobody users 28 May 31 11:02 ./drwxrwxrwx 1 nobody users 88 May 31 10:50 ../lrwxrwxrwx 1 root root 18 May 31 11:02 IMAGES -> /mnt/user/d-root/IMAGES/root@T440:/mnt/user/images#Same result - the share contains the directory IMAGES. Edited May 31, 20251 yr by timg11
May 31, 20251 yr Community Expert What do you get from this command: ls -al /mnt/user/images and from this one:ls -al /mnt/user/images/
May 31, 20251 yr Community Expert Solution I think I see what you are troubled about. When you click on the 'images' share you only want to see the contents of the 'IMAGES'.Let's take a deep breath at this point...Going back 40+ years when I took an introductory course in UNIX from a guy who personally knew Ken Thompson, Dennis Ritchie and some of the other UNIX GURUs at Bell Labs, he started his course with basically this statement-- "There are only files in the UNIX Operating System! Even a line printer is a file. A Disk Drive is a file. A tape transport is a file. The reasoning behind this decision is simple. A user can send the output from any source to any destination using the same method."Now for a quick example. Look at this quick example:I have redirected the Output of the Echo command from stdout to a file. I could just as easily have sent it to a printer by specifying a 'printer file' rather than a file. (A complete aside, those early developers prided themselves on being able to do 'anything' using a Shell Script written for the Bourne Shell. There was a rumor at Western Electric when I worked there that they had developed a Bourne Shell script that started with a database of Telephone subscribers and produced the Telephone White Pages that every subscriber got in those days without any intervention!)Another big revelation was the fact that in UNIX (and thus, Linux), a directory is a file. Granted its contents are really a database and there is special flag that indicates that has special meaning to the UNIX and will be opened as used as required by the UNIX kernel, it is still just a file.Look carefully at the ln command. Let me grab a quote---"The ln command is primarily used to create links for files in Linux, effectively allowing one file to reference another. Doing so allows you to manage files more efficiently without creating duplicates, making this command crucial for optimizing storage and managing files in Unix-like operating systems."Remember what I said about everything being a file. Well, while a directory is a file (and that allows us to link to it), there is nothing in the ln command switches that will allow one to see the contents of the file. The Link only shows us the name of the file. And the same thing is true if we use it to built a link to a directory. We will see only the name of the directory-file depending on how we come at it.For example, if we come at it via SMB on a Windows machine, we would see this:To see the contents of the Folder " I ", one would have to click on it. It seems a small price to pay to be able to share only a portion of an Unraid Share. Without this tool, there is no way to be able to do this in Unraid. In fact, until someone stumble across this workaround, anyone who asked about how to share only a portion of an Unraid Share was told it was impossible!At this point, I would like to make a small suggestion. Rather than calling the SymLink-- " IMAGES ", call it -- " IMAGES_FOLDER " or " IMAGES_DIRECTORY ". Edited June 1, 20251 yr by Frank1940
June 7, 20251 yr Author @Frank1940 thanks for the background. This is the first time that I've found something that is easy in Windows, and not possible in Linux. Usually it's the other way around. ;-)I was trying to keep the sharing paths identical for existing scripts on the clients that write their images. If I have to modify those scripts I might as well just change them to \\d-root\images and avoid the complexity of the symlinks. Another thing that Windows does well is allow different permissions for nested shares. For example I could give read/write permission to \\IMAGES to all the clients, but limit access to \\d-root to a few, or make it read only. When it comes time to make an off-site backup, it is simple to mirror d-root to the external drive and it contains IMAGES and other directories.
June 13, 20251 yr Author I found a new twist on this sharing workaround. It turns out that when a client accesses the share through the symlink path, it is able to read and write (according to the user permissions in Unraid), but gets "Access Denied" when trying to delete anything.Navigating back through the root of the share tree allows read/write and delete access. Edited June 13, 20251 yr by timg11
June 13, 20251 yr Community Expert I just tried and I could delete files. (Did not try a directory.)I even completely turned off access for the Share Access user for the root share for the Link. I tried two different Share Access users. I deleted old files and I deleted new files that I uploaded today.I created an empty folder (Directory) and deleted it.All of this was done using Windows 11 PRO (24H2) File Manager.Not sure what is going on...EDIT: I did not try a mapped drive. I did everything starting from the server down to the SMB shares. Edited June 13, 20251 yr by Frank1940
June 13, 20251 yr Community Expert I vaguely remember when looking through Windows Properties that somewhere deep down in permissions there is a separate setting for 'delete'. The reason I remember it is that I thought it strange that you could deny 'delete' privileges when you still had read-write privileges! (After all, you could just delete the entire contents of the file but you could not delete the file pointer to what was then an empty file!)
June 14, 20251 yr Community Expert I decided to so a bit of playing around this evening. Let's start with this screenshot:It shows both paths to the root directory of my Symbolic Linked Share--- SymLinkShare.This is what these paths looks like from Windows: Uploading Attachment...Now I am going to copy a file and add a folder to the Symbolic Linked Share using Windows Manager. Notice that the new File and added Folder are not showing up in the screenshot to the right. The "I" directory in both screenshots are the same directory!!!Now let's look at it from the Linux file system:Notice that the added file and new directory is not showing up. This basically means that they are not be stored on a physical device. If this is true, then they must be stored in RAM memory. This means they will disappear when the server is rebooted and the available storage space is limited to the amount of free RAM you have available!The point being made is that you must never store anything new in the root of any Symbolic Linked Share. Everything has to be stored inside of the directory that the Symbolic Link is pointing to. Edited June 14, 20251 yr by Frank1940
January 19Jan 19 Hey, I created a plugin to allow for custom samba shares, I think this might work for your use-case. https://forums.unraid.net/topic/195826-plugin-custom-smb-shares/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.