How can I disable USB sharing on my MT300N-V2?


#1

I desired a more complicated Samba setup than what was available through the GUI, so I edited smb.conf.template manually. After setting that up I realized that the router had automatically set up an extra share in the Windows Network view, “sda1”. The issue here is that there is no real security on “sda1” and anybody can browse it. I can change some of that in the “Advanced Settings” of the web GUI, but any changes disappear on reboot. Interestingly, “sda1” is the only share shown in the sharing page of that GUI. On the main (non-advanced) settings for the router, the box to enable or disable sharing is checked and grayed out. I am on the latest firmware.

I would like to just disable whatever feature is causing the “sda1” share to be automatically created. Can anyone tell me how to do this?


#2

Find and remove this file.

/etc/hotplug.d/block/50-samba


#3

I have a similar problem with samba file shares resetting on every boot on an ar750S. I found that the file /etc/hotplug.d/block/50-samba was forcing a reset to default on each power up/reboot. I was able to prevent the action by modifying that file by adding an “exit” command to prevent deleting the share configs.
The section of the modified file looks like:
[ “$sharepath” = “/mnt/$label” ] && {
exit # mod to save share configs
uci delete samba.@sambashare[$i]
}
The mod stops the deletion of the config. I have not had any other effects from making that mod, but I also don’t know why the config settings are being purposely deleted. Maybe someone can supply some insight.
Note that the change to /etc/hotplug.d/block/50-samba has to be made after every firmware upgrade and also after the shares have been set up the way you want them using Luci.

Hope this helps you.


#4

The share is reset when there is new USB devices plugged. The router does not know if the user removed an old stick and inserted a new one, so have to delete all the old ones if there is remove action.


#5

@alzhao, deleting the file did not resolve my issue, though my research showed it did for some. I figure the most likely difference is the fw version. What version are you on?

@mainer, I really appreciated your reply. I should clarify upfront that I have manual entries in my smb.conf.template file. I went into Luci and deleted the sda1 share, saved/applied, then reloaded samba, and the sda1 share disappeared. I then edited the file as you recommended, but when I rebooted the share was created again. I also tried manually deleting the entry for the share from smb.conf in addition to these steps, but that also did not work. Fwiw I am also decent with bash and I’m sure I entered the change correctly. This device is so useful. I agree that it’s a shame they make it so difficult to set up shares the way I want them. Just curious, what firmware are you on?

@alzhao, no device is being removed. I set up my shares manually in smb.conf.template. They do work, but the router is creating another share called sda1 that provides world readable access to all of the files on the partition/drive. The presence of that share with no security totally negates the security of the shares I created manually, making the sharing feature of this device much less useful to me (because I still have to set up another server/drive to host the secure shares).


#7

You should Remove 50-samba


#8

@alzhao, I should apologize. I performed this step previously with no luck, but I think the key may have been deleting the share in Luci before rebooting, in addition to this step. When I did those things just now and rebooted my issue was resolved.


#9

@rrdein Glad that you found a solution, but to answer your questions for any future readers:
I am currently running version 3.009 on the ar750s, but my mod has been working from version 3.002. Note that the edit is in the add) section of the case statement.
I have realized that many of the issues are due gl-inet to trying to have a device that works for both entry level and advanced users. With help from the people here, I have been able to get the ar750s to do what I need.

@alzhao Could your developers use the data from the blkid command in the config for the share to determine at boot if the share was new or pre-existing? Baring that, a normally off Luci setting to not erase the share config would be useful.


#10

Can you submit using the bug tracker?


#11

Thank you for the suggestion, I have filed a report.