Samba HowTo

1. Intro

This shows you how to give all users on your network a shared drive where they can read and write files. We use Samba, the Open Source implementation of Windows networking (NetBIOS/SMB).

Samba 2.0.x was packaged for OpenWrt, because the newer versions are overkill for the CPU and memory available on a typical device.

Samba offers a lot more options but this would be out of the scope. For more information on Samba see the links at the button.

2. Requirements

3. Installation

Configure your device to use the backports repository, see OpenWrtDocs/Packages for instructions, then install the package:

ipkg install samba-server

TIP: A Samba client package is available too:

ipkg install samba-client

4. Configuration

The default Samba configuration uses the /tmp directory for storage.

/!\ WARNING: All data is lost in /tmp after a reboot. See LocalFileSystemHowTo for alternative storage options.

To change settings edit the /etc/samba/smb.conf file.

Start Samba with

/etc/init.d/samba start

4.1. localhost

If samba does not start, try adding your router's name and ip in /etc/hosts. (see also http://forum.openwrt.org/viewtopic.php?id=5401)

5. Clients

NOTE: In the default config file all users are only able to read on the share, since all users use the nobody account. You can change this in the /etc/samba/smb.conf file.

5.1. Linux clients

List shares with smbclient:

smbclient -L <server_name> -N

Connect to a Samba share with:

smbclient //<server_name>/<share> -U <username>

Connect with smbfs:

smbmount //<server_name>/<share> /<local_mount_point> -o username=<username>

5.2. Windows clients

Now you should be able to browse your share called tmp from any computer that is a member of OpenWrt workgroup (the default workgroup name in Windows is WORKGROUP).

List shares with net:

net view \\<server_name>

Connect to a Samba share with:

net use * \\<server_name>\<share> /user:<username>

5.3. MacOS X clients

In the Finder, press Command-K for the mount popup. In the Server Address text box, type:

smb://<server_ip>/<share>

You may press the "+" sign to save this in your list. Press "Browse" to see all shares on a server, or "Connect" to mount the share. You'll see the icon appear on the desktop, and the share will be mounted in /Volumes.

6. Problems

If you get the following error message while starting samba:

nmbd: can't load library 'libgcc_s.so.1'
smbd: can't load library 'libgcc_s.so.1'

Just create a softlink for the library:

ln -s /lib/libc.so.0  /lib/libgcc_s.so.1

or, much better install the right package ([28-01-2007 - m4rc0] libgcc_3.4.4-8_mipsel.ipk now included in RC6.):

ipkg install libgcc

I experience problems trying to mount samba shares using mount.cifs from other openwrt machines or from ubuntu. This does not happen with my samba 3.0.22 shares from my ubuntu main machine. Be aware that there may be some issue in accessing Openwrt samba shares using cifs. by johncass

With the CIFS code of linux-2.6.23.8 I don't have any file access at all. You can browse the directories, but file access results in following errors in the Samba daemon:

write access:
smbd[4177]:   map_share_mode: Incorrect value 40000000 for desired_access to file \xxxxx
read access:
smbd[4177]:   map_share_mode: Incorrect value 80000000 for desired_access to file \xxxxx

SOLUTION: Enable "SMBFS-Support" in linux kernel. Do not use Samba in a version higher than 3.0.26, the Samba people break compatibility to Samba 2.x in these versions intentionally because they want to support only CIFS in the future.

7. Links

SambaHowto (last edited 2008-01-11 17:22:59 by ChrisRyan)

Almost all of these pages are editable, create an account and click the edit (Edit) button at the top of the page.