TrueNAS Scale very simple Samba share config

Hi guys,
I’m trying to do something quite trivial, but it doesn’t work as I expect and I really don’t have a clue why is that.

In order to work on a clean system I tried all of these tests with TrueNAS appliance running on VirtualBox VM.

Here is my pool:

root@truenas:~# zfs list | grep mnt
Tank                                                   1.23G  15.7G   104K  /mnt/Tank
Tank/Share                                               96K  15.7G    96K  /mnt/Tank/Share
boot-pool/ROOT/24.04.0/mnt                               96K  25.3G    96K  /mnt
root@truenas:~#

In order to keep the things really simple and don’t mess with ACLs I decided to create standard (general) type of dataset, check this out:

When I click on edit of the SMB share I see “Default Share Parameters”:

image

On a Unix Permission Editor I see:

If I try to locally create a new file or folder with the mentioned user, all good:

test1@truenas:/mnt/Tank$ cd Share/
test1@truenas:/mnt/Tank/Share$ mkdir Zz
test1@truenas:/mnt/Tank/Share$ touch Zz/Aa
test1@truenas:/mnt/Tank/Share$ ls -la
total 2
drwxrwx--- 3 test1 test1 3 May  8 08:42 .
drwxr-xr-x 5 root  root  5 May  8 08:20 ..
drwxr-xr-x 2 test1 test1 3 May  8 08:42 Zz
test1@truenas:/mnt/Tank/Share$ ls -la Zz/
total 2
drwxr-xr-x 2 test1 test1 3 May  8 08:42 .
drwxrwx--- 3 test1 test1 3 May  8 08:42 ..
-rw-r--r-- 1 test1 test1 0 May  8 08:42 Aa
test1@truenas:/mnt/Tank/Share$

But if I try to to the same over Samba I got “Permission denied”

kpucko@elementaryOS:~$ sudo mount -t cifs -o username=test1,password=test1 //192.168.56.107/Share /mnt
[sudo] password for kpucko:       
kpucko@elementaryOS:~$ mkdir /mnt/Aa
mkdir: cannot create directory ‘/mnt/Aa’: Permission denied
kpucko@elementaryOS:~$ 

You would say, did you restarted the Samba service?
And yes, I did it:

root@truenas:~# systemctl restart smbd
root@truenas:~# systemctl status smbd
● smbd.service - Samba SMB Daemon
     Loaded: loaded (/lib/systemd/system/smbd.service; enabled; preset: disabled)
     Active: active (running) since Wed 2024-05-08 08:45:40 PDT; 1s ago
       Docs: man:smbd(8)
             man:samba(7)
             man:smb.conf(5)
   Main PID: 64212 (smbd)
     Status: "smbd: ready to serve connections..."
      Tasks: 3 (limit: 9139)
     Memory: 6.9M
        CPU: 59ms
     CGroup: /system.slice/smbd.service
             ├─64212 /usr/sbin/smbd --foreground --no-process-group
             ├─64214 "smbd: notifyd" .
             └─64215 "smbd: cleanupd "

May 08 08:45:40 truenas systemd[1]: smbd.service: Deactivated successfully.
May 08 08:45:40 truenas systemd[1]: Stopped smbd.service - Samba SMB Daemon.
May 08 08:45:40 truenas systemd[1]: Starting smbd.service - Samba SMB Daemon...
May 08 08:45:40 truenas systemd[1]: Started smbd.service - Samba SMB Daemon.
root@truenas:~#

The result is the same :slight_smile:
Samba4 testparam command looks like expected, except the fact there is nothing about my user test1:

root@truenas:~# testparm
Load smb config files from /etc/smb4.conf
lpcfg_do_global_parameter: WARNING: The "syslog only" option is deprecated
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        bind interfaces only = Yes
        disable spoolss = Yes
        dns proxy = No
        load printers = No
        logging = file
        max log size = 5120
        passdb backend = tdbsam:/var/run/samba-cache/private/passdb.tdb
        printcap name = /dev/null
        registry shares = Yes
        restrict anonymous = 2
        server multi channel support = No
        server string = TrueNAS Server
        winbind request timeout = 2
        idmap config * : range = 90000001 - 100000000
        fruit:zero_file_id = false
        fruit:nfs_aces = false
        rpc_server:mdssvc = disabled
        rpc_daemon:mdssd = disabled
        idmap config * : backend = tdb
        create mask = 0775
        directory mask = 0775


[Share]
        ea support = No
        path = /mnt/Tank/Share
        posix locking = No
        read only = No
        smbd max xattr size = 2097152
        vfs objects = streams_xattr shadow_copy_zfs acl_xattr zfs_core io_uring
        tn:vuid =
        fruit:time machine = False
        tn:home = False
        tn:path_suffix =
        fruit:time machine max size = 0
        tn:purpose = DEFAULT_SHARE
root@truenas:~#

Any ideas are welcomed.
Thanks in advance.

you can create dirs under /mnt/Tank/Share/

try mkdir /mnt/Tank/Share/Aa

When you create the dataset you need to make sure to specify it is for SMB.

The reason is if you don’t then you are using Unix permissions. You’ll see that in one of your original screenshots.

Looking at your examples, this might be an issue on your client rather than the server. If you check your mount command, you’ll notice that you’re mounting the SMB share as root with sudo. If you check /mnt from your ElementaryOS machine, I bet it’s owned by root (meaning your kpucko user won’t have permission to use it).

To fix this, you can change your mount command slightly. Let’s assumer id -u kpucko returns 1000. After the -o flag, append, uid=1000. That should mount the share with your user as the owner of the local directory.

Alternatively, you can try a GUI application such as smb4k to do the mounting for you.

1 Like

Yeah :-))))) many thanks dude, you saved my day!

kpucko@elementaryOS:~$ sudo mount -t cifs -o username=test1,password=test1,uid=1000 //192.168.56.107/Share /mnt
[sudo] password for kpucko:       
kpucko@elementaryOS:~$ ls -la / | grep mnt
drwxr-xr-x   2 kpucko root        0 May  8 15:42 mnt
kpucko@elementaryOS:~$ mkdir /mnt/Aa
kpucko@elementaryOS:~$ touch /mnt/Zz
kpucko@elementaryOS:~$ ls -la /mnt/
total 4
drwxr-xr-x  2 kpucko root    0 May  9  2024 .
drwxr-xr-x 18 root   root 4096 Apr 30 07:54 ..
drwxr-xr-x  2 kpucko root    0 May  9  2024 Aa
drwxr-xr-x  2 kpucko root    0 May  9 09:33 Zz
kpucko@elementaryOS:~$ 

Nice! I’m glad you got it sorted

1 Like

Thank you very much for your support!
Have a nice rest of the day.