Home
Install the samba package.
Start by copying the default config from the samba git repo to /etc/samba/smb.conf. In this file change/set the following global configuration values:
workgroup = WORKGROUP server string = Fiiillleees hosts allow = 192.168. 192.178. 127. log file = /var/log/samba/%m.log guest account = smbshare load printers = No printcap name = /dev/null disable spoolss = Yes # map non-existent user ids to guest user map to guest = Bad User
This will enable anyone on the local network (assuming a 192.168.0.0/16 network) to access the network shares. This is suitable for a lazy home setup or LAN party.
Anonymous users use the guest account. There is also one user account (loebl) for write access to all shares to add data without ssh access.
The guest user only has to exist, he does not login. Make this user part of the netusers group created earlier.
useradd smbshare usermod -d / -s /usr/bin/nologin smbshare usermod -a -G netusers smbshare
In addition to exist in the base system, the user also has to be added to the samba user database.
#useradd loebl #loebl already exists on the system is reused as samba login #passwd loebl smbpasswd -a loebl
The NetBios server can safely be enabled to start at boot: systemctl enable nmbd.service. The samba server should only be started if the storage is available. For this we use the same approach as was used for the torrent server. Edit the storage mount: sytemctl edit srv-stroage.mount and add another Wants line (or create the Unit section and add the first Wants line):
[Unit] Wants=smbd.service
Also edit smbd.service to state the dependency on this mount. Enabling smbd.service is not recommended, as we don’t want it at boot time. systemctl edit smbd.service:
[Unit] Requires=srv-storage.mount After=srv-storage.mount
There are mutliple rules needed to allow netbios and samba traffic through the firewall. Create the file in_nmbd.conf in /etc/nft_rules:
udp dport 137 accept
udp dport 138 accept
As well as in_smbd.conf:
tcp dport 139 accept
tcp dport 445 accept