Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creat a User Share Containing a Portion of Another User Share

Featured Replies

This Guide has been made redundant by an Unraid plugin. See here for details:

https://forums.unraid.net/topic/137806-creat-a-user-share-containing-a-portion-of-another-user-share/#findComment-1608354

======================================

Over the years, there have been inquiries about setting up a separate User Share which contains only a portion of another User Share.  In the past, the standard answer has been, "There is not a way to do that" or words to that effect.  Recently, in another thread, a query about doing this,  @tjb_altf4 suggested using a symbolic link.  The OP, @Prawcess, for that thread did some research, tried it, and said it did work.  

 

Since no details were provided, I decided to do some experimenting on my own.  I began by googling   Linux symbolic link directory     and found many articles about implementing a Symbolic Link that involved the use of the Linux  ln -s  command. I also got it to work without any real difficulty. While I am not Linux Guru, I realize that many Unraid users are very gun-shy to undertake command line operations without a step-by-step guide. 

   

First create a new share (named   SymLinkShare  in this case). You can use the GUI to do this under the SHARES tab. Set up the share for export and sharing.  (As a bit of disclosure, since I was working on my Test Bed server, I actually emptied out an old test share and renamed it.)

Then I used the following command line in the Unraid terminal window:

ln -s /mnt/user/RoseMediaTest/I /mnt/user/SymLinkShare

Where:

      /mnt/user/RoseMediaTest/I   -------> is the path to the directory (  I  ) within another User Share ( RoseMediaTest ) that is wanted as the root for the linked share.

     /mnt/user/SymLinkShare       -------> is the path to the newly created share

 

Everything that I have try to do on my linked share has worked--

  • Copy files to it.

  • Copy files from it.

  • Rename a file.

  • Delete a preexisting file.

  • Open a file using the default application.

  • Edit a file and save it back.   

 

One thing that is different is that the Symbolic Linked Share will only use the 'cache' if the original Share is setup to use the cache drive.  In fact, the directory tree created on the cache drive is for the original Share when the copy is being made to the Symbolic Linked Share.  Since it is standard, the Unraid Mover script worked normally.

 

What are the disadvantages to using a Symbolic Linked Share?  A Symbolic Linked Share is a 'Backdoor' to the inside of another Share.  It could easily be a security issue/problem. I verified that I could write to the Symbolic Linked Share via SMB even when that SMB user does not have any access privileges to the original Share that the Link is pointed to!  (I am not set up to test what happens with NFS...) Be very aware if you do this, the permissions you give to the various users can give those users permission to modify/rename/delete the original files in the other Share!!!!  Remember that there is only one physical set of files/directories and these files/directories can be changed from either Share. My suggestion would be to make only one of the Shares be 'read-write' and the other Share be 'read-only' but that decision is strictly up to the server administrator.  

 

You may be wondering why I am posting up this Guide. There have been inquires in the past for a way to be able to do what a Symbolic Linked Share will do and the response has been "it is not possible".   I hate to know that there is a way when someone asks how to configure their Unraid server to work the way they need it to and say "No, it is not possible".  My observation is that there are always going to be problems or issues with any workaround solution.  If you are comfortable with these, then use the workaround!

 

If you find something that is a problem or have a concern that I have overlooked, please post it up in this thread.  


At this point, I want to show the output of the Linux  ls -al   command when it displays a symbolic link depending on how the path to that link is specified.

root@Rose:~# ls -al /mnt/user/SymLinkShare
total 0
drwxrwxrwx 1 nobody users   6 Apr 10 12:32 ./
drwxrwxrwx 1 nobody users 116 Apr 10 12:58 ../
lrwxrwxrwx 1 root   root   25 Apr 10 12:32 I -> /mnt/user/RoseMediaTest/I/

 

root@Rose:~# ls -al /mnt/user/SymLinkShare/I
lrwxrwxrwx 1 root root 25 Apr 10 12:32 /mnt/user/SymLinkShare/I -> /mnt/user/RoseMediaTest/I/

 

root@Rose:~# ls -al /mnt/user/SymLinkShare/I/
total 87842328
drwxrwxrwx 1 smbuser users           6 Apr 10 13:23 ./
drwxrwxrwx 1 nobody  users          15 Dec  5  2021 ../
-rw-rw-rw- 1 smbuser users      216078 Dec  6  2021 Isn't_It_Romantic-poster.jpg
-rw-rw-rw- 1 smbuser users       60514 Aug  8  2019 Isn't_It_Romantic.TAG
....


Notice that the command   (  ls -al /mnt/user/SymLinkShare/I  ) only shows the symbolic link that stored at that location.  
Whereas,  the command  ( ls -al /mnt/user/SymLinkShare/I/  )--- notice the final '    ' --- shows the files/directories stored at the location where the symbolic link is pointing.  (If you know why Linux behaves this way, you can count yourself as a Linux Guru!)

Edited by Frank1940

  • 1 month later...
  • Author

If you are wondering how to remove a symbolic link, I would suggest starting by Googling---    Remove a Symbolic Link in Linux      and you will find links such as the following one:

 

       https://linuxhint.com/remove-symbolic-link-linux/

 

DISCLOSURE: I have not removed the symbolic link that I set up using the procedure described in the first post but I do have some thoughts on the process. 

 

First thing, all the directions that I have seen assume that you are in the directory where the link is at.  So you will need to use the Linux  cd   command to change to the proper directory,  and after using that command, you should check that you are in the right directory by using the    pwd    command.

 

Second thing, notice the warning that a tailing back-slash---   /    ---can change what happens with the both commands.

 

Third thing, I, personally, would only use the  unlink  command.   The   rm    command is one that I know can be extremely destructive!  (I suspect that using the tailing back-slash after the name of the symbolic link will remove the files and directories that the symbolic link points to rather than the link itself.)

  • 8 months later...
  • 2 months later...

@Frank1940

 

I have a question regarding permissions. 

 

Let say that I create a user and I want it to be able to write to only a subfolder of a share. Would this method work? 

 

Basically, I'll give that user write acces to SymLinkShare (only this share, no other read or write permissions). Would it be only able to write to /mnt/user/RoseMediaTest/I or it will alse be able to write to the parent directory (/mnt/user/RoseMediaTest)? 

 

Thank you for attention :)

  • Author
34 minutes ago, Benbou said:

Basically, I'll give that user write acces to SymLinkShare (only this share, no other read or write permissions). Would it be only able to write to /mnt/user/RoseMediaTest/I or it will alse be able to write to the parent directory (/mnt/user/RoseMediaTest)? 

 

If I remember correctly, I did test this type of scenario and that user would not be able to access the portion of the share up-stream from where the Symbolic Link to pointing to.   However, that user would be able to access everything down stream from that point. 

  • Author
On 4/12/2023 at 9:12 AM, Frank1940 said:

I verified that I could write to the Symbolic Linked Share via SMB even when that SMB user does not have any access privileges to the original Share that the Link is pointed to! 

Read this  quote carefully as it answers your question in round about way. 

Perfect! 

Thank you for your very fast reply! :)

  • 1 year later...
  • 8 months later...
  • Author

@zapbranagann has created an Unraid plugin that will handle all of details of creating and maintaining a 'User Share containing a portion of another User Share'. You can find details here:

https://forums.unraid.net/topic/195826-plugin-custom-smb-shares/

I would suggest using this plugin rather than following the steps that I detailed in this thread as @zapbranagann has covered all of the steps and details to creating, setting permissions, and managing this type of share. Plus, it is integrated into the Unraid GUI which makes it no-brainer to setup and manage even for the neophyte!

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.