Home » Networking » OpenWrt » Samba Smb Share Openwrt Luci

How to Set up a Samba/SMB Windows Share in OpenWrt with LuCi

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.

Install Dependencies/Packages

You will need to install two packages to set up the network share:

  • samba4-server
  • luci-app-samba4

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.

Setting up The Share

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:

mkdir /path/to/new/directory

Once the new directory is created, enter it into the Path section in the Shared Directories entry.samba

Permissions

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.

SHARE:
Photo of author
Author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment