Samba Update

WARNING! This howto does NOT work on BlueRings by default. Please read elswhere in this wiki BEFORE attempting to UPDATE your SAMBA. Otherwise you will be left with incorrect permissions and a NAS that NO user can access. You've been warned. Be sure to READ ALL comments (link at bottom of page) before proceeding.

DISCLAIMER: This has only been confirmed to work on white light MBWE!
The WD MyBook doesn't have the fastest file transfer, most of the time you will end up at 10MB/sec. on a Gbit LAN connection when using samba. Looking at top on the MyBook one can see that smbd hogs a whole CPU for transfer, so any optimization in the Samba server might speed things up a little bit. Also the version of Samba on the White Light MyBook only supports a three year old version of Samba, which didn't communicate folder updates to the other clients very well, i.e. folder watching was basically not happening.

Updating Samba will give:

  • an increase of around 1MB/sec. in transfer speed, which is 10%
  • folder watching
  • other advanced Samba features (please add to this list)


WARNING: Since I only have access to a white light MBW I cannot confirm that this will work for blue ring MBWs

1) Log into MBW via ssh as root

ssh root@<mbw IP>

2) Install Samba via optware

/opt/bin/ipkg update
/opt/bin/ipkg install samba

This will create the Samba binaries in /opt/bin and /opt/sbin and the Samba config and start script in /opt/etc/samba and /opt/etc/init.d/.
Also a message will be shown that the old config from 3.0.x will not work with Samba 3.2.x, but actually it does.

3) Activate the new Samba server as default

Copy over the old config:

cp /etc/samba/smb.conf /opt/etc/samba/smb.conf

Backup the old start script:
cp /etc/init.d/S90smbd /etc/init.d/_S90smbd

Rename the new start script to avoid later confusion:
mv /etc/init.d/S90smbd /etc/init.d/S90smbd_new

Then edit the start script, with e.g. vi or nano:
vi /etc/init.d/S90smbd_new

Change the following lines:
  • Line 16: CONFIG = /etc/samba/smb.conf => CONFIG=/opt/etc/samba/smb.conf
  • Line 28: nice -n -20 /usr/sbin/smbd -D => nice -n -20 /opt/sbin/smbd -D
  • Line 37: /usr/sbin/nmbd -D => /opt/sbin/nmbd -D

then restart the Samba daemon by:

/etc/init.d/S90smbd_new restart

Now the new Samba server is running and will be automatically satrted when the MBW boots.
You need to RESTART (logout and login is NOT enough) any Windows client after updating the Samba server to access the new shares, due to some weird caching in Windows.

4a) Configuring the new Samba server (Samba 2.x)

The config for the new Samba server can be found in /opt/etc/samba/smb.conf, so changing the samba config would involve editing this file, i.e.

vi /opt/etc/samba/smb.conf

and restarting the Samba daemon after that
/etc/init.d/S90smbd_new restart

UPDATE: After I successfully followed these steps, I observed my Windows 7 machines were not being able to authenticate with Samba, which caused non-public shares to become inaccessible. After lots of googling around and some trial-and-fail attempts, I was able to verify that the following step seems to have been missing:

The new Samba seems to look for its smbpasswd file in the default location, which is the same folder where smb.conf is (/opt/etc/samba). You'll probably notice an empty smbpasswd file in this folder. This will prevent new Samba to properly authenticate clients and map them to Linux users.

The solution for me was to simply add following to [global] section in /opt/etc/samba/smb.conf :

smb passwd file = /usr/private/smbpasswd

4b) Configuring the new Samba server (Samba 3.x)

Samba 3.x not adds additional features to smbd, but sadly also makes it necessary to change the configuration a bit. First of all, edit smb.conf as root

vi /opt/etc/samba/smb.conf

and remove or comment the line that says

Next you need to migrate your old samba 2.0 password database to the new 3.x format. As root, run
pdbedit -i smbpasswd:/usr/private/smbpasswd

This will import all your old user accounts into the old database. Then restart the samba daemon
/etc/init.d/S90smbd_new restart

Alternative: There is also the possibility to use the old smbpasswd as backend, I didn't try that and cannot guarantee that this works. As root, edit smb.conf

vi /opt/etc/samba/smb.conf

and add a line that says
passdb backend = smbpasswd

This should presumably make use of the old smbpasswd file.

5) Deactivating the new Samba server

If you want to disable the new Samba server, and use the old binaries and config (/etc/samba/smb.conf), simply swap the start scripts in /etc/init.d/:

mv /etc/init.d/S90smbd_new /etc/init.d/_S90smbd_new
mv /etc/init.d/_S90smbd /etc/init.d/S90smbd

then restart the Samba daemon:
/etc/init.d/S90smbd restart
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License