Now i can crate a folder before i start sharing it. Technically i can share any foldr but if i am running APPARMOR or SELinux i might need to change the context to let smb access to the shared folder
the best place to create shared home directoried (folder), is under /srv
sudo mkdir -p /srv/samba/corp
cd samba
Here, you can start creating folder for different purposes like a corp ‘corporation’ folder or marketing folder or anything
sudotestparmLoadsmbconfigfilesfrom/etc/samba/smb.confLoadedservicesfileOK.WeakcryptoisallowedServerrole:ROLE_STANDALONEPressentertoseeadumpofyourservicedefinitions# Global parameters[global]logfile=/var/log/samba/log.%mlogging=filemaptoguest=BadUsermaxlogsize=1000obeypamrestrictions=Yespampasswordchange=Yespanicaction=/usr/share/samba/panic-action%dpasswdchat=*Enter\\snew\\s*\\spassword:*%n\\n*Retype\\snew\\s*\\spassword:*%n\\n*password\\supdated\\ssuccessfully*.passwdprogram=/usr/bin/passwd%userverrole=standaloneserverserverstring=%hserver (Samba, Ubuntu)unixpasswordsync=Yesusershareallowguests=Yesidmapconfig*:backend=tdb[homes]browseable=Nocomment=HomeDirectoriesreadonly=Novalidusers=%s[printers]browseable=Nocomment=AllPrinterscreatemask=0700path=/var/spool/sambaprintable=Yes[print$]comment=PrinterDriverspath=/var/lib/samba/printers[corp]comment=CorporateDocumentspath=/srv/samba/corpreadonly=Novalidusers=touk+corp
Once we have all that configured, Let’s test it:
sudo apt install smbclient
touk@ubuntu:/srv/samba$smbclient-LlocalhostPasswordfor [WORKGROUP\\touk]:SharenameTypeComment--------------------print$ DiskPrinterDriverscorpDiskCorporateDocumentsIPC$IPCIPCService (ubuntu server (Samba, Ubuntu))toukDiskHomeDirectoriesSMB1disabled--noworkgroupavailable
And VOILA, i can see corp is shared.
Now i can go and create a folder and see if it is going to be shared: