How to properly set up Samba?

I’ve tried several times to create a Samba Share. But unfortunately failed all the time. As I don’t know much about networking, I can’t find out where is the problem.
Today I tried to create a SMB share but this time unlucky too. Here how I configured my profile:

Step 1: creating smb.conf
Inside /etc/samba/ I’ve created a smb.conf file as follows:

[global]
server string = File Server
workgroup = MEDIA
security = user
map to guest = Bad User
name resolve order = bcast host
include = /etc/samba/share.conf

and the share.conf like this:

[Public Files]
path = /home/myUserName/Public/SMB_Public
force user = smbuser
force group = smbgroup
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775
public = yes
writable = no

Step 2: creating user & user group
After that I created a user group as

sudo groupadd --system smbgroup

then created a user with:

sudo useradd --system --no-create-home -g smbgroup -s /bin/false smbuser

Step 3: creating shared folder and giving permissions
Then I created the share folder which is in my case ~/Public/SMB_Public

mkdir ~/Public/SMB_Public
sudo chown -R smbuser:smbgroup ~/Public/SMB_Public
sudo chmod -R g+w ~/Public/SMB_Public

*Step 4: Restarting smb.service
Now I restarted smb.service

sudo systemctl restart smb.service

The output of tesparm is:

❯ testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        map to guest = Bad User
        name resolve order = bcast host
        security = USER
        server string = File Server
        workgroup = MEDIA
        idmap config * : backend = tdb
        include = /etc/samba/share.conf


[Public Files]
        create mask = 0664
        directory mask = 0775
        force create mode = 0664
        force directory mode = 0775
        force group = smbgroup
        force user = smbuser
        guest ok = Yes
        path = /home/myUserName/Public/SMB_Public

Everything seems to be OK. This shared folder is visible in my android phone(SMB). But can’t access with guest account. Where to change? I really don’t understand where is the problem.

1 Like

Maybe you need to set a min protocol in global parameters section.

Mine looks like this: client min protocol = SMB2
I have this too: usershare allow guests = yes
username map = /etc/samba/smbusers

I’ve put client min protocol = SMB2 in [global] section. But didn’t work.
I’ve also added usershare allow guest = yes in share.conf but didn’t work either.
And I don’t have this file /etc/samba/smbusers