Basic Samba Setup
- This guide is without the usual explanations.
- It is intended for those who just want to get it done.
- Further information and in-depth guides is linked below.
It is assumed the system is up-to-date with the package samba synced
The following values are used
Item | Value | Description |
---|---|---|
User Group | smbusers | the usergroup allowing write access to the share |
Device path | /dev/sdy1 | example device partition path |
Partition Label | MySharedData | name of the partition with the shared files |
Mount Point | /a/MyShare | the local mount point providing access to the files |
Share Name | MyShare | name of share exposed by samba |
Workgroup | MYHOME | samba workgroup name |
-
Create a group called
smbusers
sudo groupadd smbusers
-
Add your username to the group
(you must log off for the group to take effect - even for testing)sudo gpasswd -a $USER smbusers
-
Ensure your user is in the samba password database
sudo smbpasswd -a $USER
-
Create the mountpoint
/a/MyShare
and assign group permissionssudo mkdir -p /a/MyShare sudo chmod g+w /a/MyShare sudo chgrp smbusers /a/MyShare
-
Enable mounting by Partition Label
sudo e2label /dev/sdy1 MySharedData
-
Create a mount unit for your data disk/partition
sudo touch /etc/systemd/system/ a-MyShare.mount
Open the file and edit the content of the mount unit
[Unit] Description=Mount MySharedData partition [Mount] What=/dev/disk/by-partlabel/MySharedData Where=/a/MyShare Type=auto Options=rw,noatime [Install] WantedBy=multi-user.target
-
Enable and Start the unit
sudo systemctl enable --now a-MyShare.mount
-
Edit the file
/etc/samba/smb.conf
to contain[global] server role = standalone server max log size = 50 map to guest = Bad Password guest account = nobody unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully* obey pam restrictions = yes pam password change = yes server string = My Samba File Service workgroup = MYHOME log file = /var/log/samba/%m.log [MyShare] path = /a/MyShare guest ok = no browseable = yes comment = Share for laptop exchange read only = no inherit permissions = no
-
Enable and start samba and nmb services
sudo systemctl enable --now smb nmb
-
Ensure the service is discoverable
sudo systemctl enable --now avahi-daemon
Mount unit documentation
Other samba guides
- [root tip] [How To] Manjaro NAS (Network Attached Storage) service
- [root tip] [How To] Share and Access NTFS devices using Samba
- [root tip] [How To] Basic Samba Setup and Troubleshooting
- [root tip] [How To] Samba Server From Scratch
- [root tip] [How To] SAMBA fileserver over WiFi using Raspberry Pi
- [root tip] [Utility Script] GIO mount samba share