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
Answer from Andrew on askubuntu.com
🌐
Gonscak
gonscak.sk
How to install samba server on centos 7 with and without user and password – www.gonscak.sk
#for anonymous mkdir -p /mnt/aaa chmod -R 0777 /mnt/aaa chcon -t samba_share_t /mnt/aaa -R chown -R nobody:nobody /mnt/aaa
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
🌐
LinuxQuestions.org
linuxquestions.org › questions › red-hat-31 › how-to-create-a-samba-share-without-a-password-860443
[SOLVED] How to create a samba share without a password
February 3, 2011 - Dear Gentleman, Would you pls tell me how to create a smb share without prompting win users for a password? I have been banging my head on wall over
🌐
Liberian Geek
liberiangeek.net › home › how-to/tips › create and configure samba shares in centos 7
Create And Configure Samba Shares In CentOS 7 | Liberian Geek
February 7, 2015 - In the Samba configuration tutorial, three separate shares with different access levels are created. One allows full access to everyone without passwords, the second allows users in a specific group, and the last share permits only a single ...
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
🌐
Megocollector
it.megocollector.com › tips-and-tricks › configure-a-public-share-with-samba-on-centos-7-linux
Configure a Public Share with Samba on Centos 7 Linux – it.megocollector.com
August 16, 2014 - A CentOS7 Linux server was used to create Samba shares so that Windows clients of a home network may back up their stuff, resulting in one share with read write access. The ultimate goal was to create a Samba share that would act as if it were one of those off-the-shelf “solutions” like a Buffalo Linkstation, where no user password is required.
🌐
MangoLassi
mangolassi.it › topic › 10112 › creating-an-anonymous-samba-share-in-centos-7
Creating an anonymous samba share in CentOS 7 | MangoLassi
August 21, 2016 - The ip address of my samba host is 192.168.1.100. Now we can access the share from our windows pc using \\192.168.1.100\public ... [root@localhost ~]# smbclient -L 192.168.1.100 Enter root's password: Domain=[MYGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10] Sharename Type Comment --------- ---- ------- public Disk IPC$ IPC IPC Service (Samba Server Version 4.2.10) Domain=[MYGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10] Server Comment --------- ------- LOCALHOST Samba Server Version 4.2.10 Workgroup Master --------- ------- MYGROUP LOCALHOST WORKGROUP TECHNICOLOR
Find elsewhere
🌐
TecMint
tecmint.com › home › samba › how to install samba4 on centos 7 for file sharing on windows
How to Install Samba4 on CentOS 7 for File Sharing on Windows
July 1, 2017 - smb.conf- [Anonymous] comment = Anonymous File Server Share path = /srv/samba/anonymous browsable = yes writable = yes guest ok = yes read only = no force user = nobody account = nobody testparm- [Anonymous] comment = Anonymous File Server Share force user = nobody guest ok = Yes path = /srv/samba/anonymous read only = No Reply · Thank you for the article. My problem is: a dialog pops up “Windows Security”, “Enter your password to connect to: CENTOS” I have found the cryptic network password under Control Panel\Network and Internet\HomeGroup\View and print your home group password. Reply ... I still cannot figure out the sharing without password even I had follow your step.
🌐
Computertechblog
computertechblog.com › configure-an-smb-server-accessible-without-a-user-or-password-in-redhat-centos
Configure an SMB server accessible without a user or password in RedHat / CentOS | ComputerTechBlog
January 29, 2019 - Here is a quick way to configure an Samba server accessible by everyone without a username or password. The below has been tested in CentOS 6.5. Install the Samba service and create a directory yum -y install samba mkdir /mysamba chmod 777 /mysamba chcon -R -t samba_share_t /mysamba
🌐
Techoism
techoism.com › how-to-install-samba-server-in-centos-rhel-7-8-password-less
How to Install Samba Server in CentOS/RHEL 7/8 Password Less
July 16, 2022 - [global] workgroup = WORKGROUP server string = Samba Server %v netbios name = centos-8 security = user map to guest = bad user dns proxy = no ntlm auth = true · After this change, we must append a new share at the end of the file.
🌐
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
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.

🌐
LinuxVox
linuxvox.com › blog › how-to-install-and-configure-samba-on-centos-7
How to Install and Configure Samba on CentOS 7 — linuxvox.com
Open File Explorer and enter \\CENTOS-SAMBA (or \\server-ip) in the address bar (replace server-ip with your CentOS server’s IP, e.g., \\192.168.1.100). Double-click Public—you should see the directory without a password prompt (guest access).
🌐
HowtoForge
howtoforge.com › home › samba server installation and configuration on centos 7
Samba Server Installation and Configuration on CentOS 7
Check the permission of the shared folder. ... Now the anonymous user can browse & create the folder contents. You can cross check the content at the server also. ... Therefore, I will create a group smbgrp & user srijan to access the samba server with proper authentication. ... [root@server1 samba]# smbpasswd -a srijan New SMB password:<--yoursambapassword Retype new SMB password:<--yoursambapassword Added user srijan.
🌐
DBsGuru
dbsguru.com › home › how to setup passwordless samba share in linux for windows server access
How to Setup Passwordless SAMBA Share in Linux for Windows Server Access - DBsGuru
May 6, 2024 - In this article, we will perform required steps to setup Passwordless SAMBA Share on Linux Server. This can permit everyone on a windows machine to get entry to this without a set off for password.
🌐
Linuxize
linuxize.com › home › centos › how to install and configure samba on centos 7
How to Install and Configure Samba on CentOS 7 | Linuxize
February 27, 2019 - In “Internet or network address”, enter the address of the Samba share in the following format \\samba_hostname_or_server_ip\sharename. Click “Next” and you will be prompted to enter the login credentials as shown below: In the next window, you can type a custom name for the network location. The default one will be picked up by the Samba server. Click “Next” to move to the last screen of the connection setup wizard. Click “Finish” and the files on the Samba server will be shown. In this tutorial, you have learned how to install a Samba server on CentOS 7 and create different types of shared and users.
🌐
Hosting Ultra So
hostingultraso.com › help › centos › securely-sharing-resources-samba-centos
Securely sharing resources with Samba in CentOS
If it is a Windows-based client, open the Windows Explorer address bar and use the following syntax: \\<ip address of the Samba server>\<linux username>. For example, we use \\192.168.1.10\john (on successfully connecting to it, you need to enter your Samba username’s password). On any Linux client system, (the package, samba-client, needs to be installed on CentOS 7) to list all the available shares of an NFS server, use the following line: smbclient -L <hostname or IP address of NFS server> -U <username>