Files
.profile/recipes/samba/02_configure-share.md
JotaOdiceu 8266e47963 refactor(samba): streamline install and configure recipes
Reorder and clarify Samba setup instructions across recipes.
Remove redundant "Configure Samba" section from install.
Consolidate "Create Samba User" in install recipe.
Relocate service verification to post-restart in configure recipe.
Correct 'smbd --version' command.
2026-07-04 17:19:40 -03:00

1.3 KiB

Configure Samba Share

This recipe configures a basic Samba file share.

Backup Existing Configuration

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

Create Configuration

Replace the existing configuration.

sudo tee /etc/samba/smb.conf >/dev/null <<'EOF'
[global]
   workgroup = WORKGROUP
   server string = Samba Server
   security = user
   map to guest = Bad User

[Share]
   path = /srv/samba
   browseable = yes
   writable = yes
   guest ok = no
   read only = no
   create mask = 0664
   directory mask = 0775
EOF

Create Share Directory

sudo mkdir -p /srv/samba

Configure Permissions

Replace <username> with your Linux username.

sudo chown -R <username>:<username> /srv/samba
sudo chmod -R 775 /srv/samba

Validate Configuration

testparm

Expected output:

Loaded services file OK.

Restart Samba

sudo systemctl restart smbd
sudo systemctl restart nmbd

Verify Services

systemctl status smbd --no-pager
systemctl status nmbd --no-pager

Both services should be reported as active (running).

Verify Share

smbclient -L localhost -U <username>

Expected output should include:

Sharename       Type
---------       ----
Share           Disk