How to setup a Samba server in Linux and share SMB shares

How to setup a Samba server in Linux and share SMB shares

Note that this guide will create a public share with no authentications.

First, install the necessary packages

sudo apt-get update && \
 apt-get upgrade -y && \
 apt-get install ntfs-3g exfat-utils exfat-fuse samba samba-common -y

Create a folder to share and implement permissions

mkdir /mnt/shared
sudo chmod 777 /mnt/shared

Insert share into the end of the Samba config file at etc/samba/smb.conf

sudo echo '[MySharedFolder]
comment = "MySharedFolder"
path = /mnt/shared
read only = no
writeable = yes
browseable = yes
create mask = 0777
directory mask = 0777
public = yes
guest ok = yes
guest only = yes
guest account = nobody
' >> /etc/samba/smb.conf

Restart Samba and Nmbd

/etc/init.d/smbd restart
/etc/init.d/nmbd restart

Your shared folder should now be active over the network.