Configuring Samba File Sharing on OpenWrt

Setting Up Samba on OpenWrt

Required Pcakages

To enable Samba file sharing with support for various filesystems including FAT32, exFAT, and NTFS, install these packages:

  • luci-app-samba4
  • kmod-fs-ext4
  • kmod-fs-f2fs
  • mkf2fs
  • block-mount
  • blockd
  • kmod-fs-autofs4
  • kmod-fs-ext4
  • kmod-fs-nfs/kmod-fs-nfs-common
  • kmod-fs-ntfs3
  • kmod-fs-vfat
  • kmod-fs-fuse
  • kmod-usb-storage
  • kmod-usb-storage-extras
  • mount-utils
  • ntfs-3g
  • lsblk

Block Device Management

After connecting a USB storage device, check the available block devices. In this example, we have a new drive named STORAGE_HDD formatted with NTFS:


root@OpenWrt:/# block info
/dev/ubiblock0_1: UUID="9dd39244-6da44be1-375f0c26-39420196" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/ubi0_2: UUID="0b54af08-264e-4ac3-9663-b0f9448b95ae" VERSION="w5r0" MOUNT="/rom/overlay" TYPE="ubifs"
/dev/sda1: UUID="4234CA8734CA7E13" LABEL="STORAGE_HDD" MOUNT="/mnt/sda1" TYPE="ntfs"

Detect the storage configuration:


root@OpenWrt:/# block detect
config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option  target  '/mnt/sda1'
        option  uuid    '4234CA8734CA7E13'
        option  enabled '0'

Export this configuration to the fstab file:


root@OpenWrt:/# block detect > /etc/config/fstab

Enable the detected storage device:


root@OpenWrt:/# uci set fstab.@mount[0].enabled='1'

Save the configuration:


root@OpenWrt:/# uci commit fstab

Apply the changes to mount the device:


root@OpenWrt:/# block mount

Verify the mount by checking fliesystem usage:


root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                18.0M     18.0M         0 100% /rom
tmpfs                   247.5M      3.7M    243.8M   1% /tmp
/dev/ubi0_2              83.2M      1.1M     77.9M   1% /rom/overlay
overlayfs:/overlay       83.2M      1.1M     77.9M   1% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1               931.5G    154.4G    777.1G  17% /mnt/sda1

Adding Samba Users

Create a Samba user account. Here's an example for adding an admin user:


root@OpenWrt:~# smbpasswd -a admin
New SMB password:
Retype new SMB password:
Added user admin.

Luci Web Interface Configuration

For easy network access, configure your device's hostname in the DHCP and DNS settings through the Luci interface. This allows devices on your local network to access the Samba share directly using the hostname. In this example, we'll use the admin account created earlier.

Tags: openwrt Samba file-sharing network-storage Luci

Posted on Tue, 29 Sep 2026 16:50:02 +0000 by mahenderp