Create a public Samba share accessible without a login
Normally a Samba share will require login with a username and password, but sometimes you just want anyone on the network to access a specific share without needing to worry about that. Here's a quick and easy way of making a (fairly insecure) Samba share available to anyone on your local network.
Sections
Prepare the user and share
Create a new user for the share, and give it whatever password you want when prompted, it won’t be used to access the share anyway.
sudo adduser public
The folder /home/public
will be automatically created, we’ll be using that as the public share. Let’s give everyone full read/write permissions:
sudo chmod -R ugo+rw /home/public
The configuration file
Use this minimal smb.conf
:
[global]
workgroup = WORKGROUP
server string = Samba %v %h
# The below should make transfers faster and is optional
strict allocate = Yes
allocation roundup size = 4096
read raw = Yes
server signing = No
write raw = Yes
strict locking = No
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
min receivefile size = 16384
use sendfile = Yes
aio read size = 16384
aio write size = 16384
[public]
comment = Public Samba Share
path = /home/share
browseable = yes
writeable = yes
read only = no
public = yes
guest only = yes
force user = share
force group = share
force create mode = 0666
force directory mode = 0777
![]()
The parameters before
[public]
is optional, I found this blog post about it and I have definitely noticed it makes transfer speeds a little faster.
Next check that the syntax of the config file is valid:
testparm
If all is good, restart the Samba service for the changes to take effect:
sudo systemctl smbd nmbd
Now you should be able to access the share from a Windows PC on the same network without being prompted for a login.