Installing Samba >=3.0.14a-4 on Unslung 4.2x beta or later
Assumptions for these instructions
First, copy the default samba config files over to the new samba directory:
(Please note that on OpenSlug, the config file is on /usr/lib/smb.conf (old) or /etc/samba (new))
Samba configuration (smb.conf, smbpasswd)
If you've done the copying of the Samba 2 configuration to the new Samba 3 directory, you will find that /opt/etc/samba/smb.conf and /opt/etc/samba/smbpasswd are just links to /share/hdd/conf/share/. After each reboot, the smb.conf and smbpasswd files in /share/hdd/conf/share/ are overwritten; files residing directly in /opt/etc/samba/ are not.
Samba 3 will read its configuration from /opt/etc/samba/, but the Linksys web interface will modify the Samba configuration in /share/hdd/conf/share/. This leaves the following options:
Option A: Remove the symlinks.
No diversion script is required. However, you lose the ability to modify the configuration via the Linksys web interface. In the future, modify the Samba configuration either by directly editing /opt/etc/samba/smb.conf or via the SWAT web interface.
To remove the symlinks, execute the following commands:
then update the /opt/etc/samba/smb.conf for Samba 3 as shown in the next section.
Option B: Diversion script.
When rebooting the system the symlinked smb.conf and smbpasswd will be overwritten with the original Samba 2 version. To keep the Samba 3 files, you need a copy of them in a location where they will not be touched. The best spot for this is /unslung/
First, copy the original files to /unslung/:
You will need to remove the link to the old file and point to the new file with a diversion script.
This should allow you to fully use the Linksys web interface, keep both file locations intact and not have to start the v2 server before starting the v3.
smb.conf modifications for Samba 3
Next, you will need to edit the smb.conf file so it will work with samba 3.0. The Samba project has a smb.conf man page which explains each of the parameters in detail. It is a useful reference to have while working on the configuration.
If you're new to Linux editors, the vi editor which comes standard with UnSlung is very unfriendly (google "vi" to learn the basics). The nano editor ("ipkg install nano") is much more intuitive. Alternatively use your favourite editor on your favourite operating system and ftp the resulting file to the nslu2.
An example smb.conf file that works is:
Make sure you edit the "hosts allow = 127.0.0.1 10.0.0. 10.0.1. 10.0.2." section to include your network.
Another second example smb.conf file generated using the SWAT utility. Optimised for Unslung firmware (added by RobHam Sept 2007 + Mod Sept 2008).
The file is configured with three accessible shares. 1. A users 'home' folder, 2. a 'public' folder which can be accessed by any connecting client using netbios, and 3. 'read only' access to the full NSLU-2 directory structure.
The file configures Samba in 'User' mode. In this mode, a users 'home' folder is only accessible if the 'user name' and 'password' are identical on both the server and client.
A users 'home' folder and read only access to the full Linux directory tree 'ADMIN 1' are only accessible by using mapping on the client (for security they are non browseable).
Mapping example using the NSLU-2 netbios name -
Mapping example using the NSLU-2 IP address -
For non-unslung firmware, like openwrt, you need to change
I recommend using the below conf file, change your workgroup name, the interface IP to your NSLU2 IP, hosts allow to your client IP range, don't use the Admin1 or Disk1 sections here. Instead copy only those 2 sections out of your old version 2 smb.conf file. If you do this, you should see the same shares behavior out of your Samba 3 install as you saw from Samba 2
Finally, edit /opt/etc/init.d/S08samba to activate Samba:
Now you are ready to restart
If all goes well, the stock samba will stop and your new samba will start. Don't be suprised if running a "ps" shows two smbd & nmbd tasks, compared to one each previously. This is normal.
(On OpenSlug, you need to use /etc/init.d/samba restart)
Troubleshooting installation and configuration
Using server comment to gather version information
The NSLU2 web interface lets you set a "Server comment". This corresponds to the smb.conf parameter "Server string". This string will appear in browse lists next to the machine name.
Samba recognises two special strings.
Resolving 'Unable to open printcap file /opt/etc/printcap for read'
Note that some users have reported seeing messages in the Samba error logs similar to 'Unable to open printcap file /opt/etc/printcap for read'. This is probably because Samba is trying to open a nonexistant file. Easily fixed by logging in as user 'root' at a console screen and then check if the file exists. If not, create a blank file using the two commands:-
interfaces configuration (Dec 2008, od3-ripe)
For me on unslung SWAT started reporting smbd/nmbd "not running" though they actually did. Took me some time to figure out what fixes this behavior. After adding also "localhost" to:
it works, again. (Also see note about adding <myEth-IP> below - looks like "ipx0" and "lo" no longer get properly translated!?)
interfaces configuration (Samba 3.2, July 2008)
This version of Samba seems to need an IP/mask pair added to the 'interfaces' config line in the 'Global' section to work properly with Unslung firmware. A typical config line (assuming the default NSLU2 IP address) is:-
Further, it seems you MUST have "bind interfaces only = yes" in smb.conf, or else nmbd chokes. You can see the problem by starting nmbd in interactive mode: "nmbd -i -d 5". nmbd cannot find the interface unless you ALSO include the "bind interfaces only" line.
See the smb.conf man page on bind interfaces only for details.
Unable to connect in Samba 3.2.1-1 (9/27/08)
After struggling for days on end to get Samba running in Unslung 6.10 with an NTFS disk on Disk 1, I ran across this: http://www.nabble.com/Can%27t-Get-Upgrade-to-Samba-3.2.x-Working-td19361476.html
Basically, ran "ipkg install gconv-modules" and now my shares are working.
unix extensions / wrong share permissions (Ingo Karkat, 25-May-2009)
After upgrading to Samba 3, files created by user A (from a Linux client which mounted the Samba shares via CIFS) suddenly were not writable by user B, even though the configured share permissions gave write access to both users, and this worked flawlessly with Samba 2. This was caused by the following:
With Unix extensions enabled (by default), a Unix (not Windows!) client can set arbitrary file permissions (when mounting as cifs, not smbfs). To prevent this, one could configure a 'force create mode' + 'force directory mode' on individual shares, but it seems clients would still be allowed to chmod() later on, so this isn't totally watertight. If you don't need these extensions, it is best to turn them off globally, restoring the plain functionality of Samba 2.
Resolving issue that file modification times aren't preserved when copying files
After a) unslinging my NSLU2 and b) upgrading my Mac OS X machine from Mac OS X 10.3 to 10.5, I noticed that when I copied files from my computer to the NSLU2's share, the modification times for the files were no longer preserved. They were reset to the current time. Also, the
Adding a %v to my server comment, I discovered that I was running Samba 3.0.11. I upgraded Samba to the current (as of December 2009) version in ipkg, which was 3.2.15-1. After this, my Mac OS X system preserved modtimes when copying files to the NSLU2's share. Also, the
I've tested this setup, it seems to work correctly and maintain compatibility with the Linksys web interface and the Storage Link windows tray app that mounts USB Memory sticks when inserted into slot 2.
From FVH: On my setup (Unslung 5.5 with Samba 3.0.21) the following diversion scripts / update tricks were not required. Samba 3 functions correctly after reboots. Getting Samba 3 running was literally as simple as: ipkg update ; ipkg install samba ; create /opt/etc/samba/smb.conf ; edit /opt/etc/init.d/S08samba. Then restart. That's all.
Configuring optional features
SWAT (Samba Web Administration Tool)
See the separate SWAT page.
International character support or Unicode support
If you want to store files from Windows using foreign characters from languages like Chinese, Japanese, Korean, etc you definitely need Samba 3, as it supports this out of the box.
Here is what you should add to [global] section of the smb.conf for Samba 3.X.X to enable Cyrillic (Russian) support for Windows XP clients
I use these settings for support of Norwegian and Portugeese characters in filenames under Unslung 6.8 (samba 3): unix charset = UTF-8 dos charset = CP850 display charset = ISO-8859-1 I put these settings into /unslung/smb.conf and put the rc.samba in the same directory (comment away the first line). You also have to change the config file name in /unslung/smb.conf.
File size >= 2G and remote smbfs mount
When mounting smbfs the default does not include large file support, which limits files to less than 2 gigs. Using the lfs option will include large file support. Google "smbfs lfs option", since it seems to be missing from most documentation.
A better option is to use cifs, if it's supported by your kernel/distribution/version. When mounting cifs, large files are supported by default.
So either : mount -t smbfs //server/share /mountpoint -o lfs other-options or mount -t cifs //server/share /mountpoint -o options
view · edit · print · history · Last edited by RobHam.
Based on work by Jim DeLaHunt, Ingo Karkat, od3-ripe, lizardcry, Ralph Finch, bitbucket, colin gebhart, RobHam, Søren Bech Christensen, hzheng, Jeffrey Gao, amichelf, xypron, vatachnio, Vegard HB, EgorKobylkincom, BrianZhou, Peter Brown, frankvh, ST, Eiffel, JNC, tman, Mark, Dan Scott, KGP, marvin_ii, James, Joe USer, and J.
Originally by John.
Page last modified on February 25, 2010, at 07:24 PM