Create a public Samba Share.
First thing you’ll need to do is install Samba:
sudo apt-get update
sudo apt install samba
The private samba share need user authentication with user name and password.
sudo mkdir /home/Private
Then set the share permission so that only members of a select group will have access to it.
sudo groupadd security
Next, grant the group access to the folder.
sudo chgrp security /home/Private
sudo chmod -R 0770 /home/Private
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Next, run the commands below to open/create a new configuration file.
sudo nano /etc/samba/smb.conf
Then add the content below into the file and save. Our share will be called Private as defined in the settings below [Private]
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
name resolve order = bcast host
dns proxy = no
bind interfaces only = yes
# add to the end
[Private]
path = /home/Private
writable = yes
guest ok = no
read only = no
browsable = yes
create mode = 0777
directory mode = 0777
valid users = @security
Save the file and exit.
sudo usermod -aG security richard
The commands above add the user name salman to the security group.
Then run the commands below for each member of the group to create a Samba password. This is required.
sudo smbpasswd -a salman
When prompted, create and confirm a new password for salman account.
sudo systemctl restart smbd
Now go and test the share using sohail account, from the network directory.