Sample Header Ad - 728x90

Is there any clean way to create samba share for multiple homes?

1 vote
1 answer
2594 views
I'm using [homes] section for every user for their /home/username directory. The code in smb.conf is like this
[homes]
   comment = Home Directories
   browseable = no
   read only = no
   create mask = 0664
   directory mask = 2775
   valid users = %S
But I also have a 2nd disk and I want to create /home2/username for everyone on it. Now I add one path for every user like this and it is so tedious.
[jack2]
    browseable = no
    path = /home2/jack
    read only = no
    create mask = 0664
    directory mask = 2775
    valid users = jack

 [fiona2]
    browseable = no
    path = /home2/fiona
    read only = no
    create mask = 0664
    directory mask = 2775
    valid users = fiona
...
I wish there is something like (this doesn't work)
[%S2]
    browseable = no
    path = /home2/%S
    read only = no
    create mask = 0664
    directory mask = 2775
    valid users = %S
so I don't need to add each one for them (the share name has a '2' appended to its name to distinguish it from the normal homes). It it possible? I'm administrator of our private server. I also use lvm on it but since I'm new to lvm and for reliability reason I didn't merge all disks into a whole one so each disk has its home directory. Thanks
Asked by Jack (11 rep)
Dec 17, 2019, 07:35 AM
Last activity: Jun 15, 2025, 03:04 PM