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.

Access SMB shares based on client IP address

Featured Replies

Dear all,

 

I was trying to make Unraid SMB shares accessibility from client IP address as well as user name. From the Unraid GUI, I didn't find anything related to this, but by editing the file /etc/samba/smb-shares.conf file and adding "hosts allow =  x.x.x.x/24" then restart the samba service.

 

This is working fine, until I changed anything from the shares using Unraid GUI. When doing this, it will removes all "allow from" option I've had added.

 

I'm wondering if this feature is supported. If not, maybe it would be a nice one to add.

 

Regards,

Yanick

Edited by yquirion

Solved by yquirion

  • Community Expert

I am going to link you to the    smb.conf   document.  Search this document for   hosts allow   parameter.  I believe it is a 'share only'  parameter and you will have to add it to the smb-extra.conf file on your flash drive.  (The  edited contents of   /etc/samba/smb-shares.conf  file are lost when the server is rebooted.)

 

https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html#HOSTSALLOW

 

(Disclosure:  I have never tried to do this but I believe you have to add a  [SHARE]  section (for the share in question) to that file.  Test with the Linux command   testparm  before starting the array after modifying the file to see that the syntax is correct.)  IF the syntax is not correct, SMB will not be started!!!)

Edited by Frank1940

  • Author

Hi Frank!

 

Thanks for your reply. I was following the same documentation as the link you paste. I can confirm you thet "hosts allow" is working well. The think is that unraid GUI doesn't seems to support that feature, so if I create a new share of modify another one, all those extra "host allow" parameters will be removed when the new config will be saved.

 

That would me great if this security option is include into unraid GUI.

 

Thank you again for your reply!

 

Best regards,

Yanick

  • Community Expert
1 hour ago, yquirion said:

The think is that unraid GUI doesn't seems to support that feature, so if I create a new share of modify another one, all those extra "host allow" parameters will be removed when the new config will be saved.

 

That would me great if this security option is include into unraid GUI.

From my previous post:

 

16 hours ago, Frank1940 said:

(The  edited contents of   /etc/samba/smb-shares.conf  file are lost when the server is rebooted.)

Or (I should have included in this post) SMB is restarted which has to occur whenever one of the .conf files are modified!

 

Any user modification must be in the smb-extra.conf file.  You can find this at   Settings  >>>  SMB   and look for the "SMB Extras:" section.  This is where the user modification go.  These are saved in the smb-extras.conf file and used to configure SMB every time it starts up.  If I were you, I would be testing the following idea about adding that parameter in the SMB Extras to see if it might work...

 

16 hours ago, Frank1940 said:

(Disclosure:  I have never tried to do this but I believe you have to add a  [SHARE]  section (for the share in question) to that file.  Test with the Linux command   testparm  before starting the array after modifying the file to see that the syntax is correct.)  IF the syntax is not correct, SMB will not be started!!!)

 

  • 3 weeks later...
  • Author
  • Solution

Hi @Frank1940,

 

Sorry for the late reply.

 

Thank you for your time answering my question. Based on what you said, I made it working by using the /boot/config/smb-extra.conf fille. Here is how that file looks like:

[Media]
        hosts allow = 192.168.112.0/24
        path = /mnt/user/Media

[nfs]
        hosts allow = 192.168.112.0/24
        path = /mnt/nfs

[data]
        hosts allow = 192.168.112.0/24
        path = /mnt/user/data

[home]
        hosts allow = 192.168.2.0/24
        path = /mnt/user/home

 

I didn't have to use the smb-extra.conf file. Just creating that file into /boot/config makes it working, even if I restart the server, it continue to works.

 

However that would be nice to have that option into the share configucation page from the GUI.

 

Thank you again for your time and best regards,

Yanick

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.