What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

How-To: Custom Samba configs on a Per User Basis

Vong

New Around Here
I was going to ask for help, but I figured it out and thought I would post a How-To guide to help the next guy

I wanted to hide shares from being visible to un-authenticated users, and only show specific shares for specific users.

Step one: Setup your Shares.
Plug your USB Drive into your router and enable your sares by going to USB Application -> Media Services and Shares -> Network Place (Samba) Share / Cloud Disk.

I have the following settings:
  • "Enable Share" set to On
  • "Allow guest login" set to Off
  • Simpler Share Naming set to Yes
  • Force as Master Browser set to Yes
  • Set as WINS Server set to Yes
  • I have one drive with Share1, Share2, Share3, Share4 as folder names
Step two: Add a second user
Your primary user which has r/w access to all shares should be the same login / password for your router. Lets say this is "User1"
I added a second user "User2". I only gave it read access to Share2 and Share4
Step 3: Save your settings - Hit Apply!

Step 4: Enable JFFS custom scritps and SSH access
Head to Administration -> System and set the following:
  • "Enable JFFS custom scripts and configs" to Yes
  • "Enable SSH" to Yes
  • "Allow SSH password login" to Yes
Step 5: SSH into your machine.
There are lots of guids to do this for your system. I use Putty from a Windows Machine
Step 6: Setup your additional config files
First browse jffs directory by typing cd /jffs/configs
Then add your base file which will hide all your shares. I left one visible so that a user could be prompted for their user / password easily to then view more shares depending on their user. Type vi smb.conf.add then press i to enter insert mode then paste the following (right click on putty) into your file:

[Share1]
browsable = no
[Share2]
browsable = yes
[Share3]
browsable = no
[Share4]
browsable = no

include = /jffs/configs/%U.conf​
Next add your user config files - copy your username from Step 1 and 2.
type vi User1.conf then paste the following in to ensure your primary user has access to browse every share:

[Share1]
browsable = yes
[Share2]
browsable = yes
[Share3]
browsable = yes
[Share4]
browsable = yes​
Next lets lock down User2 to only see Share2 and Share4. Type vi User2.conf
[Share1]
browsable = no
[Share2]
browsable = yes
[Share3]
browsable = no
[Share4]
browsable = yes​

Step 7: You are done! Reboot your router.
You will not notice that when you first visit your shared drive, you can only see Share2. If you log in as User2, you will be able to see Share2 and Share4 (which are the only two you have access to view files from). If you log in as User1 you will have full access.

I am no Samba expert, but this should be enough for you to clean up what you are showing random guests who come into your home and use your WiFi. For me, I added a visitor user with visitor password and shared some of my media files in Read Only mode and hid all the extra files that they did not need to see (log files, etc)

Someone smarter then me could extend this guide to do some fancier sharing (like allowing a guest user without a password to access some shares by default. I may figure this out eventually, but I am happy with my setup for now)

Thanks for the awesome software :)
 
Last edited:
It'd be a real shame to miss this in a title-only search, so would you kindly edit the spelling error in the title ie Custom Smaba configs...?
 
Hi

I have an DSL-AC68U and usin AiDisk to share HDD. Latest stock firmware. I also would like to hide some folders/partitions from different users. This thread is the only one I could find addressing the issue.

There are no custom script settings in the stock firmware. So is my only option to install GNUtons firmware and then follow this threads steps? Should it work for my router as well even though it is probably not with the same firmware as Vong here has ?
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Members online

Back
Top