Setup Samba (SMB) Share
Install samba using distro’s package manager. Enable in systemctl.
Setup Firewall
- Create a UFW application profile for Samba at
/etc/ufw/applications.d/samba
[Samba]
title=Samba File Server
description=The Samba software suite is a collection of programs that implements the SMB/CIFS protocol for unix systems, allowing you to serve files and printers to Windows, NT, OS/2 and DOS clients. This protocol is sometimes also referred to as the LanManager or NetBIOS protocol.
ports=137,138/udp|139,445/tcp
- Enable Samba traffic from selected subnets.
Setup Samba User
Create and Designate a Directory to Share
Update /etc/samba/smb.conf
Note: update
/home/jack/share
as necessary.
[share]
comment = My Share
path = /home/jack/share
writeable = yes
browseable = yes
public = yes
create mask = 0644
directory mask = 0755
write list = user
Restart Samba Service
Mounting the Share with Permissions
Mounting the Share Automatically with /etc/fstab
- Create a credentials file for the Samba share in
~/.smb
- Create a backup of
/etc/fstab
- Append the following to
/etc/fstab
//ip/sharename/ /mount/path cifs credentials=/home/myuser/.smb,uid=userid,gid=groupid 0 0
- Apply the changes to
/etc/fstab