This super quick tutorial will show you how to set up a Samba/SMB Windows network share on an OpenWrt device.
This tutorial works best if you have some extra storage available for your file share – check out our article on adding extra USB storage to OpenWrt here.
What is Samba?
Samba is a file sharing package which provides network file shares compatible with the SMB and CIFs protocols used by Windows.
You will need to install two packages to set up the network share:
SSH into your OpenWrt device and run the following to install them:
opkg update && opkg install samba4-server luci-app-samba4
You can also install the two packages from the LuCI web interface by navigating to:
System ? Software
…and pressing Update Packages to update the package list. Once the list is populated, you can filter and install packages by name.
When the samba4 packages have been installed, navigate to:
Services ? Network Shares
Samba comes pre-configured and is already running – you just need to add the directories you wish to share to the Shared Directories section to make them available.
To create a new directory to share, SSH into OpenWrt and create a new directory with the mkdir command:
Once the new directory is created, enter it into the Path section in the Shared Directories entry.
System file permissions will always take precedence over those provided by Samba. By default, the Samba service may not have read/write access to the newly created share directory.
If you cannot read or write to a share from a computer on the network, you may need to run the following to grant the Samba service permissions for the directory:
chmod -R 777 /path/to/shared/directory
This will grant read/write access to all users/services on OpenWrt (including Samba) to the directory. The default read/write masks provided by the Samba interface should be permissive enough for users accessing the share over the network to be able to read/write files in the share once Samba can write to the directory.