What's new

Edit smb.conf in Voxel Firmware

  • 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!

silentheaven83

New Around Here
Hi everybody,

I’m sorry for the dumb question, newbie here. I installed the latest (awesome) Voxel firmware on my R7800 and got a SSH connection.

I'd like to edit and add some lines to the smb.conf, but if I edit /etc/samba/smb.conf with nano, at the reboot it gets overwritten.

How can I do?

Thank you
 
Last edited:
Modifying it via shell is not really easy. Also see this older post:
smb.conf from /mnt/sda1/overlay isn't copied at boot

afaik, /usr/sbin/update_smb is creating/modifying the smb.conf

and this script is called from tons of different locations:
Code:
root@R7800:/rom$ grep -ir /usr/sbin/update_smb
etc/init.d/br-mode:        /usr/sbin/update_smb
etc/init.d/net-br:    /usr/sbin/update_smb
etc/init.d/net-lan:    /usr/sbin/update_smb
etc/init.d/samba:    /usr/sbin/update_smb
sbin/hotplug2.umount:/usr/sbin/update_smb
grep: sbin/led_all: binary file matches
usr/lib/opkg/info/samba-scripts.list:/usr/sbin/update_smb
grep: usr/sbin/net-cgi: binary file matches
grep: usr/sbin/readycloud_unregister: binary file matches
grep: usr/sbin/remote_share_conf: binary file matches
grep: usr/sbin/remote_smb_conf: binary file matches
grep: usr/sbin/remote_user_conf: binary file matches
usr/sbin/start_br_udhcpc:/usr/sbin/update_smb
usr/share/udhcpc/default.script.ap:            /usr/sbin/update_smb
usr/share/zcip/zcip.script:    /usr/sbin/update_smb

So a potential solution: replace the binary /usr/sbin/update_smb with some script that copies your desired smb.conf into /etc/samba/smb.conf
(and hope that the other scripts don't expect some specific exit code from update_smb)

And then accept that after that, all modifications would have to be done manually in that smb.conf.
I.e. everything in GUI that would previously make settings, will no longer have any effect.

So might be too difficult for a newbie...
 
I’ve done this. You need to save your modified file in the overlay. I’m not in front of my computer so I can’t send you detailed instructions. I’ll later today
 
OK, so I'm on an Orbi with Voxel so this might not apply 100% to your scenario. Please DO CHECK your paths and not just copy and paste!
Over time I used 2 different paths to my solution. As per the other thread, I had the same problem you had and every time there was a reboot the Samba configuration was reset. Voxel eventually fixed it and I assume it's also fixed on the R7800/R9000.

Path 1​

I edited my smb.conf, restarted Samba only and verified it worked. Once I had it working I copied it to
/mnt/sda1/overlay/etc/samba. Because in the early days the Orbi didn't read my configuration correctly at boot I also created a script that I manually ran after boot (I tried to automate that, but didn't work for me). This is the script:
Bash:
#!/bin/sh
/bin/echo "Killing Samba services" >> /var/log/messages
/usr/bin/killall smbd
/usr/bin/killall nmbd
/bin/echo "Updating Samba conf" >> /var/log/messages
cp -f /mnt/sda1/overlay/etc/samba/smb.conf /etc/samba/smb.conf
/usr/sbin/taskset -c 1 /usr/sbin/smbd -D > /dev/null 2>&1
/usr/sbin/taskset -p 1 `/bin/pidof usb-storage` > /dev/null 2>&1
/usr/sbin/nmbd -D
/bin/echo "Samba restarted" >> /var/log/messages

Path 2​

Voxel kindly fixed the issue for me so now, as long as I have the smb.conf in
/mnt/sda1/overlay/etc/samba/ it all works magically.

Conclusions​

I would suggest you try Path 2 first and if it doesn't work use Path 1. I hope this helps.
 
on R7800, /etc/samba is a symlink to /tmp/samba
thus lost at reboot and recreated during boot.

Removing the symlink /etc/samba and then copying /tmp/samba to /etc/samba will place that folder in the overlay. And thus it will persist during reboot. (but not during firmware upgraded).

But that doesn't solve the issue mentioned earlier, that /usr/sbin/update_smb will mess with the smb.conf on multiple occasions. (during boot, but also when you plug-in a usb-disk and who knows on what other moments)
You could try if placing in overlay is sufficient for your purposes. But if not then you have no other option then to replace update_smb with some custom script.
 
Thank you for your replies.

I opened (total newbie here) update_smb with nano and I saw that the smb.conf “template” is hard coded in there.
It would be great to add the possibility to create a file in a certain position that would be appended to the template.
 
Thank you for your replies.

I opened (total newbie here) update_smb with nano and I saw that the smb.conf “template” is hard coded in there.
It would be great to add the possibility to create a file in a certain position that would be appended to the template.
I'll think over your request. Something what was already done for Orbi FW. Custom, user's smb.conf.

Voxel.
 
That was me and it works great
Yeah, I remember that I've implemented this scheme for Orbi by your request.

There is the difference Orbi fw vs R7800/R9000 fw. Samba was not included into Orbi stick firmware. Added by me. So not controlled by WebGUI. R7800/R9000 firmware has samba from the beginning. Controlled from WebGUI and optimized (speed) by me. So I was not sure that custom samba config for R7800/R9000 is needed.

Voxel.
 
I'll think over your request. Something what was already done for Orbi FW. Custom, user's smb.conf.

Voxel.

I've added such possibility into snapshot version.


Full log of the changes is inside of archive. From this log:

NOTE: now it is possible to use custom user's config for samba. Just save your custom
config as '/etc/config/samba/user.conf' and it will be used instead of generation of the
new config.


Voxel.
 

Latest threads

Sign Up For SNBForums Daily Digest

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