Files
homelab/active/software_smb/smb.md
ducoterra b65ef9cbb7
All checks were successful
Podman DDNS Image / build-and-push-ddns (push) Successful in 1m10s
initial smb instructions
2025-12-17 12:32:26 -05:00

2.2 KiB

SMB

Install SMB

sudo dnf install samba
sudo systemctl enable smb --now
firewall-cmd --get-active-zones
sudo firewall-cmd --permanent --zone=FedoraServer --add-service=samba
sudo firewall-cmd --reload

Create SMB User

sudo smbpasswd -a ducoterra

Create a SMB Share

# Create share
mkdir /btrfs/pool0/smb/ducoterra

# Set proper selinux labels for samba
sudo semanage fcontext --add --type "samba_share_t" "/btrfs/pool0/smb/ducoterra(/.*)?"

# Run restorecon at the root of the btrfs subvolume
sudo restorecon -R /btrfs/pool0

Edit /etc/samba/smb.conf

[ducoterra]
        comment = My Share
        path = /btrfs/pool0/smb/ducoterra
        writeable = yes
        browseable = yes
        public = no
        create mask = 0644
        directory mask = 0755
        write list = user

Then restart SMB

sudo systemctl restart smb

Create a SMB Share with Many Users

sudo groupadd myfamily
sudo useradd  -G myfamily jack
sudo useradd  -G myfamily maria

sudo smbpasswd -a jack
sudo smbpasswd -a maria

sudo mkdir /home/share
sudo chgrp myfamily /home/share
sudo chmod 770 /home/share
sudo semanage fcontext --add --type "samba_share_t" "/home/share(/.*)?"
sudo restorecon -R /home/share
[family]
        comment = Family Share
        path = /home/share
        writeable = yes
        browseable = yes
        public = yes
        valid users = @myfamily
        create mask = 0660
        directory mask = 0770
        force group = +myfamily
  • valid users: only users of the group family have access rights. The @ denotes a group name.
  • force group = +myfamily: files and directories are created with this group, instead of the user group.
  • create mask = 0660: files in the share are created with permissions to allow all group users to read and write files created by other users.
  • directory mask = 0770: as before, but for directories.

Don't forget to restart smb

systemctl restart smb