Update samba (blue ring)

Why update?

Updating the samba server is done in order to increase transfer speeds for the samba network shares (the normal network shares accessable from Windows).
Silver Knight claimed these increases:
Upload to mybook: 3.5 MB/s -> 5 MB/s
Download from mybook: 4 MB/s -> 7 MB/s
I have not made a structured measurement myself, but also noticed an increase in transfer speeds.

Beware! Please note that you will not be able to manage shares and users from the web interface after this update (but it is easy to revert back to the old version after update).

1. Install updated samba version

… and the required lib "libiconv":

# ipkg update
# ipkg install samba libiconv

This will install several other libs that are required by samba as well.
It will take a couple of minutes…

Don't forget to run:

# ldconfig

if you don't run LDSO_RUNPATH-enabled firmware.

2. Configure mybook to use the updated version of samba

Edit /etc/init.d/samba.sh

First make a backup of /etc/init.d/samba.sh:

# cp /etc/init.d/samba.sh /etc/init.d/samba.sh.bak

… then open it.
Find the following line:

/usr/local/samba/sbin/nmbd -D -s/etc/smb.conf -l${LOGS} -d0

… and change it to this:

/opt/sbin/nmbd -D -s/opt/etc/samba/smb.conf -l${LOGS} -d0

Edit /etc/inetd.conf

First make a backup of /etc/inetd.conf:

# cp /etc/inetd.conf /etc/inetd.conf.bak

… then open it.
Find the following line:

netbios-ssn stream tcp nowait root /usr/local/samba/sbin/smbd smbd -s/etc/smb.conf -l/var/log -d0

… and change it to this:

netbios-ssn stream tcp nowait root /opt/sbin/smbd smbd -s/opt/etc/samba/smb.conf -l/var/log -d0

Edit /etc/initd/update_network_config.sh

First make a backup of /etc/initd/update_network_config.sh:

# cp update_network_config.sh update_network_config.sh.bak

… then open it.
Find the following line:

SMBconf="/etc/smb.conf"

… and change it to this:

SMBconf="/opt/etc/samba/smb.conf"

Make sure the newly installed samba is not started any by /opt/etc/init.d/S08samba

mv /opt/etc/init.d/S08samba /opt/etc/init.d/xS08samba

3. Configure samba

Copy the original samba config file to the new location:

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

Migrate samba users to the new user database:

pdbedit -i smbpasswd:/var/private/smbpasswd

4. Reboot

# reboot

More info about samba configurations in the smb.conf file

See here: http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html

User Management

I (shogyn) was not able to manage users from the web interface after this upgrade, so you will have to do it from the command line.

Add user

1. Add the user to the system:

adduser USERNAME

2. Add the user to samba

smbpasswd -a USERNAME

3. Add shares permissions

They can be either in the smb.conf file or in a file included in the smb.conf.
It looks something similar to this:

[PUBLIC]
path=/shares/internal/PUBLIC
force user=www-data
valid users=www-data JEREMIA ADMIN MARIA MAPPED_DRIVE
write list=www-data JEREMIA ADMIN MARIA MAPPED_DRIVE
guest ok=no

[PUBLIC] specifies the name of the share.
You will have to add your user to valid users and optionally also to write list (if you want the new user to have write access).

When I open my smb.conf: nano /opt/etc/samba/smb.conf,
I have the following line specifying another file with the shares settings to include in the config: include=/var/oxsemi/shares.inc
(I have noticed that other users does not have the same configuration by default.)
So I edit /var/oxsemi/shares.inc to manage my shares config.

Change password

smbpasswd USERNAME

Delete user

smbpasswd -x USERNAME

Troubleshooting

Please see this forum thread for troubleshooting: http://mybookworld.wikidot.com/forum/t-219027/

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License