Samba filesystem

From DD-WRT Wiki

Revision as of 03:12, 15 December 2008 by Gutzmer (Talk | contribs)
Jump to: navigation, search

Samba is one of a number of network file systems available to the DD-WRT platform. A network file system allows for sharing the contents of directories or entire drives across a network. In DD-WRT this can work both ways: You can run a Samba server on your main computer and run a client on your router (thus gaining writable storage for the router) or you can use Samba to share a drive connected (typically by USB) to the router among all the computers connected to your network.

Standard and larger versions of DD-WRT contain the Samba/CIFS client. Mini and Micro versions of DD-WRT do not contain Samba/CIFS. See the Wiki page What is DD-WRT?#File Versions.


Running a Samba client on DD-WRT

  1. Create a SMB network share on the host computer.
    • On Linux, use Samba to create a SMB network share. HOWTO
    • On Windows, this is the default file sharing system. Simply right click and select "Sharing and Security" to set up sharing.
    • On MacOS X, go to "Sharing" in the System Preferences and turn on "Windows Sharing" for 10.4 or in 10.5 “Share files and folders using SMB.” from the File Sharing options.
  2. Use the Web Interface and go to the Administration tab.
  3. Enable the Samba FS Automount option (or CIFS Automount). If new options do not appear the "Save Changes" and go back to the page.
  4. Enter the share location in the 'share' field. eg: //
  5. In 'user' and 'password' enter the user credentials of a user allowed to access the share.
  6. You may optionally enter a Startscript. For example if you have a script on your share \\lanserver\myshare\ you enter in the 'Startscript' box. This script (/tmp/smbshare/ on the router) will be executed when the router mounts your share on boot.

You can see sample of startup script on Jffs page.

Mount Manually

You can temporarily mount a share manually via a Telnet/SSH session:

First, insert a necessary kernel module:

insmod /lib/modules/`uname -r`/smbfs.o

Then enter these commands to mount:

mkdir /tmp/Path
smbmount //hostname/Share /tmp/Path/ -o username=<user>,password=<password_user>

Note: If using CIFS, the procedure is slightly different:

insmod cifs
nvram set samba_user="username"
nvram set samba_password="password"
mkdir /tmp/smbshare
mount.cifs //hostname/Share /tmp/smbshare -o username=$(nvram get samba_user),password=$(nvram get samba_password)
  • /tmp/Path/ is the path you want mounted
  • Only /tmp/, /dev/ and potentially /jffs/ are writeable!

Receiving errors like the following seem normal:

 load_client_codepage: filename /usr/lib/codepages/codepage.850 does not exist.
 load_unicode_map: filename /usr/lib/codepages/unicode_map.850 does not exist.
 session request to failed
 Can't get /etc/mtab~ lock filesmbmnt failed: 1

To unmount a share, enter this command in a shell prompt:

 umount /tmp/Path/
 rmdir /tmp/Path/
 rmmod smbfs

Note for Windows XP

Windows XP has what is called "simple file sharing" enabled by default. This forces guest access to the share and does not allow permissions (read, write, etc.) based on specific user accounts. If you run into problems getting CIFS to work, consider disabling simple file sharing.

To disable it, go to: My Computer -> Tools -> Folder Options -> View Under Advanced Settings: Uncheck "Use Simple File Sharing" Click Apply, OK

Optionally, run the Network Setup Wizard in Windows Control Panel in order to set up your share(s).

Password Note: Make sure the user account that you wish to access the share has a password. Windows XP will reject any logins over the network which don't use a password.

Note for Windows Server 2003

Especially on Windows Server 2003, assert that your server accepts NTLM v1.

  1. Goto Start > Run
  2. Type "gpedit.msc" and push enter.
  3. Goto Computer Configuration / Windows Settings / Security Settings / Local Policies / Security Options.
  4. Verify that "Network security: LAN Manager authentication level" is NOT "Send NTLMv2 response only\refuse LM & NTLM"

Running a Samba Server on DD-WRT

If you have a powerfull Router like the Asus WL-500gP(remium) you might want to use the USB 2.0 Ports for HD sharing with Windows Clients.

Samba server - option 1

The default way - using OpenWRT packages

a) install the USB stuff according to USB_storage
b) activate jffs
c) update the ipkg system with the following command
ipkg update
d) install samba with the following command
ipkg install samba2

samba2 is not a current package.

the samba install requires a libgcc version that is not trivial to find.

Samba server - option 2

The optware way - using Optware packages

A nice Howto for this is located here Optware
You should really try it the optware way because it works :)


If you are having issues mounting your share, hopefully the following forum post will help:
Problems mounting with cifs