Thecus N41000PRO Tweaking Samba

From TechInfoDepot
Jump to navigationJump to search

Problem description: Changes to smb.conf are lost

If you try to tweak the smb.conf file (After deciding whether it is the one in /raid0/sys or in /tmp) you will find that after every restart your changes have been lost. This happens even if you edit shared folders, the ACL or add/remove users in the web interface.

I wanted to have a system where the entry follow symlinks = yes was persistent.

The following describes one way to achieve this.

Solving the problem

There are two files named smb.conf in the system. It seems that the one in /raid0/sys (aside - note that /raid/sys and /raid/data are merely symlinks to /raid0/sys and /raid0/data respectively) is the definitive one.

The N4100PRO recreates this file after any changes to the system or at reboot. More specifically the file is recreated whenever samba is (re)started with /img/bin/rc/rc.samba.

The simplest way to change the follow symlinks line is

sed -e 's/follow symlinks = no/follow symlinks = yes/g' /tmp/smb.conf > /raid0/sys/smb.conf

To get around the restart of samba problem, do:

/img/bin/rc/rc.samba restart 1

By putting all of this in a bash script file, installing the META module, and copying the script into the startup folder of the META module (for me it was /raid0/data/module/META/system/etc/startup) this will be run at boot time.

It seems that smbd must be up and running for the smb.conf file to exist, so in order to wait for smbd, code like:

while ! ps | grep -v grep | grep smbd &>/dev/null; do
   sleep 1
   done

at the top of the shell script works ok.

As I am not sure why there is a /tmp/smb.conf, I copy my edited version to the /tmp folder as well.

This system seems to work ok and allows for fine tuning of the samba config file.

Source of information

Based on stuff from the Thecus User Group: smb.conf set back after reboot[1] and my own fiddling.

--Butibum 15:33, 10 March 2009 (CET)