OK, I have found an answer myself.

As this is absolutely not obvious from the docs and HOWTOs and whatever, the reason this thing asks for password is because it cannot map guest user to the owner of the directory being shared.

I have NTFS partitions which I need to mount RW so I used the following setup in my /etc/fstab:

/dev/sdb1  /media/disk1  ntfs defaults,noexec,noatime,relatime,utf8,uid=1000,gid=1000 0       2
/dev/sdb2  /media/disk2  ntfs defaults,noexec,noatime,relatime,utf8,uid=1000,gid=1000 0       2

The most important pieces of config are uid and gid (maybe only uid, don't know). They are set to the UID and GID of the user jonnie set up on the server (obviously not root). So, when ntfs-3g will mount these disks, everything will be owned by him.

After that, I have added this user to the Samba registry (or maybe created new identical one, don't care):

# smbpasswd -a jonnie

It asked for password, I have entered the same as for the main system.

After that, I have added the force user and force group settings to the smb.conf:

[global]
  workgroup = WORKGROUP
  netbios name = HOMESERV
  security = user
  map to guest = Bad User

[disk1]
  comment = Disk 1 on 400GB HDD
  path = /media/disk1
  browsable = yes
  guest ok = yes
  read only = no
  create mask = 666
  directory mask = 777
  force user = jonnie
  force group = jonnie

[disk2]
  comment = Disk 2 on 400GB HDD
  path = /media/disk2
  browsable = yes
  guest ok = yes
  read only = no
  create mask = 666
  directory mask = 777
  force user = jonnie
  force group = jonnie

So, most important piece of config relevant to me was force user.

Courtesy of the Samba HOWTO

Answer from hijarian on serverfault.com
Top answer
1 of 5
36

OK, I have found an answer myself.

As this is absolutely not obvious from the docs and HOWTOs and whatever, the reason this thing asks for password is because it cannot map guest user to the owner of the directory being shared.

I have NTFS partitions which I need to mount RW so I used the following setup in my /etc/fstab:

/dev/sdb1  /media/disk1  ntfs defaults,noexec,noatime,relatime,utf8,uid=1000,gid=1000 0       2
/dev/sdb2  /media/disk2  ntfs defaults,noexec,noatime,relatime,utf8,uid=1000,gid=1000 0       2

The most important pieces of config are uid and gid (maybe only uid, don't know). They are set to the UID and GID of the user jonnie set up on the server (obviously not root). So, when ntfs-3g will mount these disks, everything will be owned by him.

After that, I have added this user to the Samba registry (or maybe created new identical one, don't care):

# smbpasswd -a jonnie

It asked for password, I have entered the same as for the main system.

After that, I have added the force user and force group settings to the smb.conf:

[global]
  workgroup = WORKGROUP
  netbios name = HOMESERV
  security = user
  map to guest = Bad User

[disk1]
  comment = Disk 1 on 400GB HDD
  path = /media/disk1
  browsable = yes
  guest ok = yes
  read only = no
  create mask = 666
  directory mask = 777
  force user = jonnie
  force group = jonnie

[disk2]
  comment = Disk 2 on 400GB HDD
  path = /media/disk2
  browsable = yes
  guest ok = yes
  read only = no
  create mask = 666
  directory mask = 777
  force user = jonnie
  force group = jonnie

So, most important piece of config relevant to me was force user.

Courtesy of the Samba HOWTO

2 of 5
6

The config can be shorter:

Create unix user jonnie

sudo useradd jonnie -s /usr/sbin/nologin

Create smbuser

sudo smbpasswd -a jonnie

Create the Linux directory to share

mkdir /mysmbshare

Change the owner of the directory to jonnie

sudo chown jonnie /mysmbshare

smb.conf

[global]
  workgroup = MyWorkGroup
  server string = Hello, use me
  security = user
  map to guest = Bad User
  guest account = jonnie
  passdb backend = tdbsam
  
[the_public_share]
   path = /mysmbshare
   writable = yes
   printable = no
   public = yes

All files are owned by jonnie and everyone has rw access to the files.

Top answer
1 of 2
4

I finally found the solution:

[global]
workgroup = WORKGROUP
netbios name = NAS
log file = /var/log/samba/log.%m
max log size = 1000
logging = file
panic action = /usr/share/samba/panic-action %d
server role = standalone server
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[public]
path = /home/share
public = yes
guest only = yes
writable = yes
force create mode = 0666
force directory mode = 0777
browseable = yes

creates a share without any user/password login.

You can access it in Windows with \\NAS\public.

2 of 2
0

I use this. The script uses ACLs to gives all files in the directory to the Debian group "sambashare". This simplifies the exchange of files between local and remote users, because local and remote users can read and write all files in the directory.

mkdir /home/sambashare
chown nobody:sambashare /home/sambashare
chmod 2775 /home/sambashare

setfacl -R -dm u::rwx,g::rwx,o::r-x /home/sambashare
setfacl -R -m u::rwx,g::rwx,o::r-x /home/sambashare

cat >> /etc/samba/smb.conf <<EOF

[public]
   comment = Public Share
   path = /home/sambashare
   browsable = yes
   guest ok = yes
   read only = no
   create mask = 0664
   directory mask = 2775
   force create mode = 0660
   force directory mode = 2770
   force group = sambashare
   inherit acls = yes
   map acl inherit = yes
EOF

systemctl enable smbd
systemctl enable nmbd

usermod -aG sambashare localuser
Discussions

anonymous, passwordless samba share
Here are my notes on exactly this. Note the part about deleting any samba users you might have created when experimenting, if you want clients to not even ask for a username/password. Ask any questions. I'll try and help. https://johnsonmlw.github.io/johnsonmlw/ Edit: typo More on reddit.com
🌐 r/debian
17
8
March 28, 2024
How to Make Samba List All Shares Without Authentication
Samba 4.19.5 on Opensuse Tumbleweed, server name HOGSTORE. A large number of Windows 10 Pro (22H2) desktops as clients on workgroup 802MAGIC. I want all browseable shares on this server to be visible (not necessarily accessible) without a username/password prompt in Windows Explorer. More on forums.opensuse.org
🌐 forums.opensuse.org
0
0
March 3, 2024
Connect to RHEL SAMBA share without username/password on Windows - Unix & Linux Stack Exchange
Also public is a synonym for guest ok and only guest is a synonym for guest only. ... To recheck your configuration log out and in on your windows client, that the connection is closed. Also your should know, that your have to add the authenticated user to your guest share (when you have them), ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
July 3, 2018
View Samba shares without authentication
make sure the WORKGROUP= is the same on both truenas and client. On truenas I have guest access clicked and am able to see the shares on truenas. More on reddit.com
🌐 r/linuxmint
6
11
October 24, 2022
Top answer
1 of 3
39

Yes, Samba can be a pain. I use it for my home as well as work.

The first thing you should do is start over from scratch to make troubleshooting easier. You can do this by running the command below in the terminal.

dpkg-reconfigure samba-common

Then go to the folder on the samba server that you want to share, and make sure that the user nobody can read and write to the share. This is because the user nobody is the username windows clients use. I usually just make a folder in the / directory just to keep things simple, but the "correct" way would be to make a subfolder of /srv. If you have not modified the permissions already, use the commands below.

sudo chown -R nobody.nogroup the_folder
sudo chmod -R 777 the_folder

You can also test to see if nobody can write to the directory by running the following command as root.

sudo -u nobody touch test_file

Edit your /etc/samba/smb.conf and add the lines below the [printers] share definition.

[share_name]              ;the share name can be what ever you want
browseable = yes
path = the_complete_path_to_the_shared_folder
guest ok = yes
read only = no
create mask = 777

Then when you are done save it and run the following.

testparm

This will will warn you if you made any typos. Next, you just need to restart the samba services.

sudo systemctl restart smbd
sudo systemctl restart nmbd
2 of 3
1

I realise this is an old thread but it helped me to solve the issue of creating and sharing a folder with no login required. Plenty of other threads out there but they are misleading. I've given a semi biginners guide below as there are just so many small differences with other posts out there that I thought it might help someone else who's almost given up and pulled half their hair out :-)

For me, on a default AWS Linux image (Amazon Linux AMI 2017.03.0 (HVM)) I had to create the folder in the root dir / as I could not assign the permissions if created under the default ec2-user. When assigning the permissions I had to use nobody.nobody as nogroup didn't work. lastly I had to include map to guest = Bad User under the gloabl standalone server section where by default it says security = user

So the complete steps would be on deployment of a new server:

install samba if required

create the folder and assign permissions

sudo su
cd /
mkdir the_folder
chown -R nobody.nobody the_folder
chmod -R 777 the_folder

edit the samba file

nano /etc/samba/smb.conf

find the line # ---- Standalone Server Options ---- append "map to guest"

security = user
passdb backend = tdbsam
map to guest = Bad User

Under the section #==== Share Definitions ==== add your share

[SHARENAME]
path = the_folder
read only = no
create mask = 777
guest ok = yes

Save the file and restart samaba

/etc/init.d/smb restart
🌐
SambaWiki
wiki.samba.org › index.php › Setting_up_a_Share_Without_Authentication
Setting up a Share Without Authentication - SambaWiki
For details about setting up a share that users can access without authenticating, see Setting up Samba as a Standalone Server.
🌐
TechRepublic
techrepublic.com › home › software
How to create a passwordless guest share in Samba - TechRepublic
March 14, 2022 - To make sure Samba is only listening to that interface locate the below line: ... [public] path = /home/share public = yes guest only = yes writable = yes force create mode = 0666 force directory mode = 0777 browseable = yes
🌐
openSUSE Forums
forums.opensuse.org › english › network/internet
How to Make Samba List All Shares Without Authentication - Network/Internet - openSUSE Forums
March 3, 2024 - Samba 4.19.5 on Opensuse Tumbleweed, server name HOGSTORE. A large number of Windows 10 Pro (22H2) desktops as clients on workgroup 802MAGIC. I want all browseable shares on this server to be visible (not necessarily a…
Find elsewhere
Top answer
1 of 1
2

Basically, what I think I want but don't know how to do is to have Samba map any user that connects to a specific user on the server (I think it can be done with a user map file), and then additionally, which I haven't found out how to do, have it accept any password as valid (we have PCs with the same user account names and different passwords).

Both can be done using the same map to guest = bad user option in Samba, but unfortunately, "emulating" Guest access in this way is exactly what "Guest" access is in SMB.

One problem is that SMB servers do not receive passwords at all; they use NTLM when outside an AD domain and Kerberos within a domain. NTLM is a challenge/response protocol that additionally produces a session key to both peers, which SMB then uses to authenticate each packet (as well as the entire handshake in SMBv3 – this provides a form of MITM protection when negotiating the encryption key for SMBv3).

However, for challenge/response protocols like NTLM or CHAP to work properly, the server must already know the user's password (shared secret) – without it, the server cannot derive the NTLM session key from just the client's response alone (being able to do so would defeat the point of the protocol), and therefore cannot correctly 'sign' the SMB messages.

So the way "Guest" access in SMB works is that the server must indicate to the client, "Your credentials didn't work but I accepted you as guest anyway", so that the client would know to not require SMB message signing. If the server accepted arbitrary NTLM responses but didn't send the "Guest access" indication (if I'm reading the protocol docs right), this would result in the client failing to connect anyway.

In short, you cannot really emulate guest access without implementing actual guest access. Selecting map to guest = bad user means Samba has to indicate that this is a guest session.

(Although according to docs, only the Enterprise or Education editions of Windows 10 disables this by default, while Home/Pro does not – and if you do not have an AD domain, I think it's unlikely that you'll be using Enterprise...)


What you could do instead is the opposite: Windows does not require the logged-in user to be used for SMB – on failure it will prompt you for credentials (and will even let you save them), so you could use normal SMB authentication but create a single account with a password that everyone knows (write it next to your office Wi-Fi password). You can have a batch script to pre-save the password using cmdkey.

(This also works when accessing a domain-joined file server via Kerberos.)

🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › projects › networking and servers
anonymous passwordless samba share - Raspberry Pi Forums
Yes, don't share a directory in a users home directory, only the user will be able to traverse to it, I would create a directory under /srv and share that. Also check that '[global]' in the smb.conf file contains this line: ... [V] path = /srv/V guest ok = yes guest only = yes read only = no With that, any unknown Samba users should be able to connect to the share, provided they are not Windows pro users (they have guest access turned off by default).
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › share-the-folder-in-samba-server-without-authentication-4175597200
Share the folder in samba server without authentication
January 11, 2017 - I have a linux server running samba server and want to make a share and I don't want that the login dialog box appear in the windows box when try to
🌐
Reddit
reddit.com › r/linuxmint › view samba shares without authentication
r/linuxmint on Reddit: View Samba shares without authentication
October 24, 2022 -

tl;dr: I did some tinkering and Nemo started asking for authentication even when simply trying to view available shares on the server.

Setup: NAS with several Samba shares, one of which allows guest access; desktop with Mint 21 Cinnamon.

Previously, it was possible to view network shares in Nemo when accessing the server via Network window ("network:///") or via its samba address (e.g. "smb://nas"). What I would immediately get is a list of shared folders, e.g. "share1" etc. - pretty normal behavior.

Then, I was trying to change thumbnailers and build ffmpeg with libsmbclient support, installing various stuff and so on, it might be possible to trace some of the steps via bash_history but I doubt it will help.

Now, "authentication required" window pops up when trying to view shares (e.g. by accessing "smb://nas") with no option for anonymous access. I can't even see what shares are available without login info.

I tried rolling back to an earlier system snapshot and it didn't help. Also, there's another local user and the behavior is as expected for that user - no login popup when accessing the server. So it must be something within home directory of my user that's making Nemo ask for login. What could it be, what settings are responsible for this and is there a way to change or reset them?

EDIT:

Solved with

$ sudo killall gvfsd

Got the idea from

https://forums.debian.net/viewtopic.php?t=150964

Still don't know what was the root cause, my best guess is some PID file got stuck somewhere or something like that.

🌐
Google Groups
groups.google.com › g › linux.samba › c › ZzrOwdYwYzA
[Samba] Access to a share resource without password
On Mon, Feb 28, 2011 at 12:05:32AM -0300, J. L. Cabral wrote: > Marco, I followed your instructions and I couldn't connect, my config is: > > [global] > workgroup = CASA > netbios name = bangkok > security = user > passdb backend = tdbsam > map to guest = bad password > username map = /etc/samba/smbusers > > [grabar] > comment = file sharing > path = /var/share ... > browseable = yes > public = yes > writeable = yes > create mode = 0644 > force user = pepe > force group = pepe > > I have: > > drwxrwxrwx root nobody /var/share > > and I add user pepe: > > # useradd -s /sbin/nologin pepe > > After that I restart samba: > > # /etc/init.d/smb restart > > and fro Windows XP machine I do: > > net use X: \\10.4.133.109\grabar > > and after that I see the resource in my Explorer
🌐
STD Rocks
std.rocks › gnulinux_samba_no_password.html
Configure a Samba Share Without Password on Debian
April 12, 2025 - This guide explains how to set up a Samba server on Debian without authentication, allowing public access to shared folders.
🌐
SambaWiki
wiki.samba.org › index.php › Setting_up_Samba_as_a_Standalone_Server
Setting up Samba as a Standalone Server - SambaWiki
a share that requires authentication against a local user database on the Samba host. The following is a minimal configuration for a Samba standalone server that only allows guest access: [global] map to guest = Bad User log file = /var/log/samba/%m log level = 1 server role = standalone server ...
🌐
OneUptime
oneuptime.com › home › blog › how to set up samba with guest access on ubuntu
How to Set Up Samba with Guest Access on Ubuntu
March 2, 2026 - [public] comment = Public Guest Share path = /srv/samba/public # Allow guest access without authentication guest ok = yes # Only guest connections (no authenticated users) guest only = yes # Allow browsing the share browseable = yes # Read-only - change to no for writable read only = yes # Force all files to be created with these permissions force create mode = 0664 force directory mode = 0775
Top answer
1 of 5
10

Happened to stumble across this thread on the Ubuntu forums, and thought it might help. It explains the steps that happen behind the scenes:

In Windows the client's username and password is automatically sent when it browses for shares - this is done without the user's knowledge. That forces Samba to deal with the sent credentials even though it's a guest share that requires no authentication.

When that username is passed Samba will search through it's password database for that user:

  • If there is no match to the username the client user is tagged a "Bad User" and converted ( mapped ) to the guest account which by default is "nobody".

  • If it finds a match to the username and there is a samba password that matches the one sent by the Windows client then the Windows user automatically gains access although not as an anonymous user which is why you needed to add "force user = nobody" to your share definition.

  • If it finds a match to the username but the samba password does not match exactly the password that's automatically sent by the Windows client then you will be prompted for a password - even for a guest share.

Try adding force user = nobody to your share definition, and see if that does it.

Edit 02/20/2013:

Is testparm returning an exit code of something other than zero? All the same, I would go ahead and give that area of the config a good, hard look. Also, I'm not sure how case-sensitive smb.conf is, but every example I see (for example) of map to guest = Bad User has the B and U capitalized. Check-out the Samba man pages for the options you are using, and double-check everything.

2 of 5
10

This is how OpenElec is configured. Should do what you are asking for. (even if it is a year later...maybe it will help the next one) Just tweak the share settings as needed.

[global]
  server string = YOURSERVERNAME
  workgroup = WORKGROUP
  netbios name = %h
  security = share
  guest account = root
  socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
  smb ports = 445
  max protocol = SMB2
  min receivefile size = 16384
  deadtime = 30
  os level = 20
  mangled names = no
  syslog only = yes
  syslog = 2
  name resolve order = lmhosts wins bcast host
  preferred master = auto
  domain master = auto
  local master = yes
  printcap name = /dev/null
  load printers = no
  browseable = yes
  writeable = yes
  printable = no
  encrypt passwords = true
  enable core files = no
  passdb backend = smbpasswd
  smb encrypt = disabled
  use sendfile = yes

[share]
comment = Share
path = /share
available = yes
browsable = yes
writable = yes
public = yes
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › networking
Share Folders using Samba: why accessible without password, but not with password? - Linux Mint Forums
May 20, 2024 - Instead, in the Linux file manager I checked two options: *) Allow others to create and delete files in this folder *) Guest access (for people without a user account) And now I can access files on my Linux computer from my Windows laptop without a password. I checked it again and it works - I can transfer files in both directions. It seems the second of the options I checked overrides everything. i have in my smb.conf ... [SAMBA-SHARE] # specify shared directory comment = Personal Drive(s) path = /home/sambashare # allow writing writable = yes # not allow guest user (nobody) guest ok = no # a
🌐
Reddit
reddit.com › r/linux4noobs › [samba on linux mint 21.3] i am unable to create an anonymous samba share without authentication but a private share is working fine
r/linux4noobs on Reddit: [SAMBA on Linux Mint 21.3] I am unable to create an anonymous SAMBA share without authentication but a private share is working fine
October 31, 2024 -

Solved

There were two problems with my setup,

  • Invalid config

    I put in the line

    force user=nobody # Ensure any file created in this share is owned by this user

    guess what, you cannot put in comment like that, it has to be in a newline or else it gets treated as a line in the config. Putting the # part in next line fixed it.

  • Permission issues

    I was sharing my /home/user/Public directory. While I set my /home/user/Public to have 755 permission allowing the user nobody access to it, my home directory had 750 permission. It was like the user nobody was allowed to come to my house but was banned from entering the neighbourhood my house is located at.

    For that, I created a new directory called Public in / as

    sudo mkdir /Public

    I then changed ownership of /Public to be owned by user as

    sudo chown user /Public

    I then bind mount /home/user/Public into /Public

    sudo mount --bind /home/user/Public /Public

    Finally, I added the following line in my /etc/fstab at the end

    /home/user/Public /Public none bind 0 0

    Also dont forget to register your user with samba

    sudo smbpasswd -a user

    Choose a good password, you know the usual password rules

    I dont have to change anything for private share, only for my public share as my private share works as expected anyways. At the end, this is what it ended up to become

    [my_public_share]
    path=/Public
    read only=yes
    browseable=yes
    create mask = 0644
    directory mask = 0755
    guest ok=yes
    guest only=no
    
    [my_private_share]
    path=/home/user/SambaShare
    browseable=yes
    read only=no
    guest ok=no
    create mask=0644
    directory maks=0755
    force user=user
    # ensure files created by clients are owned by this user
    valid users=user
    # valid users is comma seperated list of who can access the files

Original question follows

I wanted to setup two SAMBA shares, one being public SAMBA share that I wish anyone in the network can read files without providing any username and password. I also want another private share where I can allow some people to perform both read and write using username and password.

The private share folder is located under /home/user/SambaShare and my public folder is located under /home/user/Public. user is the username I use to login and use my computer and because both are inside my home directory, they should by default be owned by my user.

On top of that, the Public folder is applied 755 permission so I would assume anyone could read and execute the directory whether that user is a part of my group or not. I learned that execute permission for a directory is necessary else people cannot cd into it.

I have added user as a samba passwd with the command

sudo smbpasswd -a user

ls -l shows the following for Public

drwxr-xr-x  2 user user     4096 Oct 29 18:19 Public

However, when I try to login anonymously from the Network section in the File manager, it says Failed to Mount Windows Share: Invalid Argument.

What is insane is that my private share works as expected. Here is my /etc/samba/smb.conf.Most of it is from Ubuntu default and I have mostly only added stuff at the end but I am sharing the whole config just in case there was something there messing it up.

#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which 
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  - When such options are commented with ";", the proposed setting
#    differs from the default Samba behaviour
#  - When commented with "#", the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic 
# errors. 

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
   server string = %h server (Samba, Ubuntu)

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
   max log size = 1000

# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}.
# Append syslog@1 if you want important messages to be sent to syslog too.
   logging = file

# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller". 
#
# Most people will want "standalone server" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
   server role = standalone server

   obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
   pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user

########## Domains ###########

#
# The following settings only takes effect if 'server role = classic
# primary domain controller', 'server role = classic backup domain controller'
# or 'domain logons' is set 
#

# It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
;   logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
#   logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
;   logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the 
# SAMR RPC pipe.  
# The following assumes a "machines" group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.  
; add group script = /usr/sbin/addgroup --force-badname %g

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /home/samba/etc/smb.conf.%m

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
;   idmap config * :              backend = tdb
;   idmap config * :              range   = 3000-7999
;   idmap config YOURDOMAINHERE : backend = tdb
;   idmap config YOURDOMAINHERE : range   = 100000-999999
;   template shell = /bin/bash

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 means that usershare is disabled.
#   usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
;   comment = Home Directories
;   browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
;   read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
;   create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
;   directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# Un-comment the following parameter to make sure that only "username"
# can connect to \\server\username
# This might need tweaking when using external authentication schemes
;   valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700

#[printers]
#   comment = All Printers
#   browseable = no
#   path = /var/spool/samba
#   printable = yes
#   guest ok = no
#   read only = yes
#   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
# [print$]
#   comment = Printer Drivers
#   path = /var/lib/samba/printers
#   browseable = yes
#   read only = yes
#   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin

[my_public_share]
path=/home/user/Public
read only=yes
browseable=yes
create mask = 0644
directory mask = 0755
guest ok=yes
guest only=no
force user=nobody # Ensure any file created in this share is owned by this user

[my_private_share]
path=/home/user/SambaShare
browseable=yes
read only=no
guest ok=no
valid users=user
# valid users is comma seperated list

Also, here is the log file /var/log/samba/log.

[2024/10/29 18:21:31.607361,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.607809,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.607938,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.608286,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.608463,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.527151,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.527604,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.527814,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.528231,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.528377,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.354190,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.354707,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.354843,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.355382,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.355567,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.757292,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.757822,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.758110,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.758663,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.758891,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.202809,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203198,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203325,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203784,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203917,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.830267,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.830754,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.830900,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.831251,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.831374,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.853943,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.854430,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.854665,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.855029,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.855145,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.330794,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.331348,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.331487,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.331903,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.332041,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:00:55.777001,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:00:57.166864,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:00:57.188688,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:01:01.914315,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:14.926962,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:16.523451,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:16.526750,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:17.594671,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534

I am kind of new into this stuff. Is there something I missed or did horribly? I did not want to create a new user because it may not be necessary, its okay if I use my regular user user as I am only turining SAMBA when I need it and is disabled in systemd.

One thing I am also confused is that even though Public folder is owned by user, I have set 755 permission meaning that I would expect the owner to have full permission, the members in the same group as user has the permission to read and execute and everyone else has the permission to read and execute. Because everyone is able to read and execute I would expect EVERYONE to be able to read and execute. Is nobody user not included in there?

🌐
Reddit
reddit.com › r/linuxquestions › [samba on linux mint 21.3] i am unable to create an anonymous samba share without authentication but a private share is working fine
r/linuxquestions on Reddit: [SAMBA on Linux Mint 21.3] I am unable to create an anonymous SAMBA share without authentication but a private share is working fine
October 31, 2024 -

Solved

There were two problems with my setup,

  • Invalid config

    I put in the line

    force user=nobody # Ensure any file created in this share is owned by this user

    guess what, you cannot put in comment like that, it has to be in a newline or else it gets treated as a line in the config. Putting the # part in next line fixed it.

  • Permission issues

    I was sharing my /home/user/Public directory. While I set my /home/user/Public to have 755 permission allowing the user nobody access to it, my home directory had 750 permission. It was like the user nobody was allowed to come to my house but was banned from entering the neighbourhood my house is located at.

    For that, I created a new directory called Public in / as

    sudo mkdir /Public

    I then changed ownership of /Public to be owned by user as

    sudo chown user /Public

    I then bind mount /home/user/Public into /Public

    sudo mount --bind /home/user/Public /Public

    Finally, I added the following line in my /etc/fstab at the end

    /home/user/Public /Public none bind 0 0

    Also dont forget to register your user with samba

    sudo smbpasswd -a user

    Choose a good password, you know the usual password rules

    I dont have to change anything for private share, only for my public share as my private share works as expected anyways. At the end, this is what it ended up to become

    [my_public_share]
    path=/Public
    read only=yes
    browseable=yes
    create mask = 0644
    directory mask = 0755
    guest ok=yes
    guest only=no
    
    [my_private_share]
    path=/home/user/SambaShare
    browseable=yes
    read only=no
    guest ok=no
    create mask=0644
    directory maks=0755
    force user=user
    # ensure files created by clients are owned by this user
    valid users=user
    # valid users is comma seperated list of who can access the files

Original question follows

I wanted to setup two SAMBA shares, one being public SAMBA share that I wish anyone in the network can read files without providing any username and password. I also want another private share where I can allow some people to perform both read and write using username and password.

The private share folder is located under /home/user/SambaShare and my public folder is located under /home/user/Public. user is the username I use to login and use my computer and because both are inside my home directory, they should by default be owned by my user.

On top of that, the Public folder is applied 755 permission so I would assume anyone could read and execute the directory whether that user is a part of my group or not. I learned that execute permission for a directory is necessary else people cannot cd into it.

I have added user as a samba passwd with the command

sudo smbpasswd -a user

ls -l shows the following for Public

drwxr-xr-x  2 user user     4096 Oct 29 18:19 Public

However, when I try to login anonymously from the Network section in the File manager, it says Failed to Mount Windows Share: Invalid Argument.

What is insane is that my private share works as expected. Here is my /etc/samba/smb.conf.Most of it is from Ubuntu default and I have mostly only added stuff at the end but I am sharing the whole config just in case there was something there messing it up.

#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which 
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  - When such options are commented with ";", the proposed setting
#    differs from the default Samba behaviour
#  - When commented with "#", the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic 
# errors. 

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
   server string = %h server (Samba, Ubuntu)

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
   max log size = 1000

# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}.
# Append syslog@1 if you want important messages to be sent to syslog too.
   logging = file

# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller". 
#
# Most people will want "standalone server" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
   server role = standalone server

   obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
   pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user

########## Domains ###########

#
# The following settings only takes effect if 'server role = classic
# primary domain controller', 'server role = classic backup domain controller'
# or 'domain logons' is set 
#

# It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
;   logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
#   logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
;   logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the 
# SAMR RPC pipe.  
# The following assumes a "machines" group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.  
; add group script = /usr/sbin/addgroup --force-badname %g

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /home/samba/etc/smb.conf.%m

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
;   idmap config * :              backend = tdb
;   idmap config * :              range   = 3000-7999
;   idmap config YOURDOMAINHERE : backend = tdb
;   idmap config YOURDOMAINHERE : range   = 100000-999999
;   template shell = /bin/bash

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 means that usershare is disabled.
#   usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
;   comment = Home Directories
;   browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
;   read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
;   create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
;   directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# Un-comment the following parameter to make sure that only "username"
# can connect to \\server\username
# This might need tweaking when using external authentication schemes
;   valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700

#[printers]
#   comment = All Printers
#   browseable = no
#   path = /var/spool/samba
#   printable = yes
#   guest ok = no
#   read only = yes
#   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
# [print$]
#   comment = Printer Drivers
#   path = /var/lib/samba/printers
#   browseable = yes
#   read only = yes
#   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin

[my_public_share]
path=/home/user/Public
read only=yes
browseable=yes
create mask = 0644
directory mask = 0755
guest ok=yes
guest only=no
force user=nobody # Ensure any file created in this share is owned by this user

[my_private_share]
path=/home/user/SambaShare
browseable=yes
read only=no
guest ok=no
valid users=user
# valid users is comma seperated list

Also, here is the log file /var/log/samba/log.

[2024/10/29 18:21:31.607361,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.607809,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.607938,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.608286,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:31.608463,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.527151,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.527604,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.527814,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.528231,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:21:52.528377,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.354190,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.354707,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.354843,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.355382,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:31:17.355567,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.757292,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.757822,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.758110,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.758663,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:47:21.758891,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.202809,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203198,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203325,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203784,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 18:53:13.203917,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.830267,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.830754,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.830900,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.831251,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:00:57.831374,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.853943,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.854430,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.854665,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.855029,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:01:47.855145,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.330794,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.331348,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.331487,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.331903,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 19:11:43.332041,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:00:55.777001,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:00:57.166864,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:00:57.188688,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:01:01.914315,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:14.926962,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:16.523451,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:16.526750,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2024/10/29 21:02:17.594671,  0] ../../source3/smbd/service.c:168(chdir_current_service)
  chdir_current_service: vfs_ChDir(/home/user/Public) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534

I am kind of new into this stuff. Is there something I missed or did horribly? I did not want to create a new user because it may not be necessary, its okay if I use my regular user user as I am only turining SAMBA when I need it and is disabled in systemd.

One thing I am also confused is that even though Public folder is owned by user, I have set 755 permission meaning that I would expect the owner to have full permission, the members in the same group as user has the permission to read and execute and everyone else has the permission to read and execute. Because everyone is able to read and execute I would expect EVERYONE to be able to read and execute. Is nobody user not included in there?