Simple Samba Share - NO PASSWORD

What I need:

Simple samba config for file server without password and full read write for everyone. No security needed.

History:

I'm making a server to host files for my home. The goal of the server is to host files for Windows machines. The best I've managed to do so far is this configuration. With that, I am able to see the shares and the server from the network, but it says that Windows cannot access them. I am using Linux mate at the server, all the latest updates.

My Config:

[global]

   workgroup = BIOHAZARD
   netbios name = MATUSALEM
   guest account = nobody
   log file = /usr/local/samba/var/log.%m
   max log size = 50
   security = user
   map to guest = bad user
   encrypt passwords = yes

# Share Definitions 
[homes]
   comment = Home Directories
   browseable = no
   writable = yes

[Teste]
    path = /home/peter/share
    writable = yes
    printable = no
    comment = teste
    only guest = yes
    public = yes
        guest ok = yes
        guest only = yes
        guest account = nobody
        browsable = yes
[REDE]
    comment = TESTE 2
    public = yes
    delete readonly = yes
    path = /HOME/REDE
    writeable = yes
        guest ok = yes
        guest only = yes
        guest account = nobody
        browsable = yes
######

Any Ideas?


Solution 1:

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

Solution 2:

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