Samba 4 Permissions for specific user

Hey guys, Im trying to figure out how to make setup my Samba drive to only be accessible with a specific username and password combination I have setup. But I can't seem to find any instructions that shows you how to do so for Samba 4 on OpenWRT. Im using OpenWrt 19.07.4 on a Archer A7 V5

Yeah sorry user level access needs manual configuration, we don't have official luci scripts for it.
Check this guide at the end:

Samba3/4 has the same steps if i remember correctly.

PS: I think there was a guy that made a script to-do most of the stuff, but i forgot to bookmark it, maybe search the forum?

1 Like

I followed that but it still keeps saying Read-only system when I try to write anything to it

Post the output:

uci show fstab; block info
root@OpenWrt:~# uci show fstab; block info
/dev/mtdblock4: UUID="5fa9ed01-18406008-ac87442a-2dddbdb6" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock5: TYPE="jffs2"
/dev/sda1: UUID="fd3dc231-d9d2-48ad-af8b-1fb954a6004c" VERSION="1.0" TYPE="ext4"
/dev/sdb1: UUID="4f1295b8-bce3-4992-94bc-7461bb7e7a0b" VERSION="1.0" MOUNT="/overlay" TYPE="ext4"

1 Like

Try this way:

chmod -R a=rwX /mnt/sda1

For some reason, I make changes to the /etc/samba/smb.conf file and it doesn't load up on luci and vice versa, how do I fix that?

It's problematic to diagnose unless there's a specific error message.
You can rename that file and reinstall the package to revert the settings.
Then check diff for old and new configs.

There, I just deleted all of the configuration files for it and reinstalled the app and seems to be allowing me to create folders. Im currently doing a Deja Dup backup to it, will post once it finishes

1 Like

This file is auto generated by the init service on every smb service start and than symlinked from /tmp to /etc/samba. To make permanent changes edit the smb.template file.

1 Like

Finally, it finished backing up and it actually got everything. Though I'm considering going to NFS since I just found out that Samba doesn't support UNIX permissions, which I need for Rsync. How difficult is it to setup NFS?

I actually have that installed, but RSync oddly still errors out about Unix permissions

OH I have that on my computer, not on the router itself, give me a sec and try it out

--edit 2--
Oh wait, I already have it already on the router

# OpenWrt
opkg update
opkg install shadow-useradd
useradd -m -s /bin/ash user_name
passwd user_name

# PC
ssh-copy-id openwrt
ssh openwrt
rsync openwrt:

Er, what do the commands do?

This is in case you want to configure per-user SFTP access.

What about the permissions issue though? For some reason Samba doesn't like it when I try to save with Unix permissions reserved. From what I heard apparently Samba doesn't support this at all, that's why im looking at using NFS instead of Samba, unless there's a way to make Samba take Unix permissions.

Post the error message.

**** default - Sun Oct 25 21:58:34 2020

** Launching RSYNC command:
rsync -r -t -p -o -g -v --progress -s /home/novaviper/Downloads/math2070exam2 /run/user/1000/gvfs/smb-share:server=,share=backup/Test

sending incremental file list
rsync: [generator] failed to set permissions on "/run/user/1000/gvfs/smb-share:server=,share=backup/Test/math2070exam2": Operation not supported (95)
math2070exam2/.~lock.Exam2 Content#
             83 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=5/7)
rsync: [receiver] mkstemp "/run/user/1000/gvfs/smb-share:server=,share=backup/Test/math2070exam2/.~lock.Exam2 Content#.39VgWY" failed: Operation not supported (95)
         32,768   0%   31.25MB/s    0:00:00  
      4,964,798 100%   28.18MB/s    0:00:00 (xfr#2, to-chk=4/7)
math2070exam2/Exam2 Content
             36 100%    0.21kB/s    0:00:00 (xfr#3, to-chk=3/7)
rsync: [receiver] mkstemp "/run/user/1000/gvfs/smb-share:server=,share=backup/Test/math2070exam2/.Exam2 Content.9RVt20" failed: Operation not supported (95)
math2070exam2/Table 2-1.png
rsync: [receiver] mkstemp "/run/user/1000/gvfs/smb-share:server=,share=backup/Test/math2070exam2/.Table 2-1.png.9mEBt1" failed: Operation not supported (95)

         32,701 100%  188.96kB/s    0:00:00 (xfr#4, to-chk=2/7)
         74,815 100%  429.77kB/s    0:00:00 (xfr#5, to-chk=1/7)
         32,768  77%   70.48kB/s    0:00:00  
         42,165 100%   90.70kB/s    0:00:00 (xfr#6, to-chk=0/7)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=v3.2.3]

sent 5,116,354 bytes  received 134 bytes  10,232,976.00 bytes/sec
total size is 5,114,598  speedup is 1.00
Rsync process exit status: 23

1 Like

Try mounting with vers=3.0 option.

PS: samba4 fully supports unix permissions and ACL's, but its a bit tricky to mount those correctly depending on the kernel cifs mount or samba mount client.

1 Like