[GUIDE] Samba share readonly for guest, writeable for root

I was trying to create a samba share that is readonly for guests and writable for the root user. Writing the steps here as a note for myself and other people

Disable built-in samba server in CoreELEC settings. I couldn’t add samba user with it because smbpasswd is readonly.

Copy group and passwd to /opt/etc as mentioned here

# rm /opt/etc/passwd /opt/etc/shadow /opt/etc/group
# cp /etc/passwd /etc/shadow /etc/group /opt/etc

install entware (skip this if you already have it)
# installentware

install samba4-server from entware
# opkg update && opkg install samba4-server

setup a samba password for the root user

# smbpasswd -a root
New SMB password:[password]
Retype new SMB password:[password]

Example samba share. Anyone without root password will have readonly access. Anyone with samba root password will have full access

[external]
  path = /var/media/external
  available = yes
  browseable = yes
  public = yes
  writeable = yes
  write list = root
  read list = nobody 
  root preexec = mkdir -p /var/media/external

restart samba
# /storage/.opt/etc/init.d/S91smb restart

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.