Therefore, I found a post that has a solution. Basically you can make folders inherit permissions and ownership from a root folder by making a group (who will access the files from clients and local logins) and include local users and an account called nobody, which allows anonymous authentication when users connect to the shared folders. Then you apply permissions and ownership to desired folder and edit samba configuration file.
Step 1 -- Editing group
There is already a group called users and you have to add your account (as well as other local ones) and nobody account to a group called 'users'.
sudo adduser <username> <group>
sudo adduser pavel users
sudo adduser nobody users
if you add a wring user by accident, use:
sudo deluser <username> <group>
but be careful, because a mistake can delete a user permanently.
Step 2 -- Adding permissions and ownership to the folder
Now, I want /srv/samba/share to be a shared folder and to create it use:
sudo mkdir -p /srv/samba/share #-p checks if the folder already exists.
now, perform these commands to make a group own the folder and add permissions:
sudo chown root:users /srv/samba/share
sudo chmod 2775 /srv/samba/share
Step 3 -- Configuring samba configuration file
Now, we just need to edit a file and then restart a computer.
Insert this block of text where [printers] block is located (usually at the bottom of the text file).
[public] #You can change this accordingly, it just displays the name on the network. comment = Shared Data path = /srv/samba/share #You can change this path to whatever you want. Read note though browseable = yes guest ok = yes force group = users writeable = yes create mask = 0664 force directory mode = 0775
Note: don't add you home folder as a shared one, because I had trouble with it. This is because the permissions were messed up and if you put our files in there, you would not be able to edit them if you were from Windows client.
Now save the file, then log out and login or restart.
To access the folder in Windows client, type \\serveripaddress\ in address bar of window explorer.
To do that in Ubuntu's file manager, press 'Connect to server' and type smb://youripaddress/
If anything does not work for some reason it's worth to look at the original post and follow steps to make sure it works. You will find it in the reference.
Link about sgid bit.
Link about removing user.
Another post that kinda relates to this.