20

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?

27

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
| improve this answer | |
  • This worked perfectly! Copied for future reference. the problem was the chmod thing! thank you soo much. – Peter Reynold Robinson Junior Jun 26 '16 at 19:02
  • 1
    Good job figuring it out, most would have just given up. Remember that with file sharing, on any OS, permissions are often the issue. – Andrew Jun 27 '16 at 22:52
  • 1
    Great. this works for me, I just have an issue when try to reinstall samba, but the issue was because also is needed do sudo apt-get autoremove and then sudo apt-get purge samba* – iLevi Aug 23 '16 at 17:03
  • This resultated in an error starting nmdb after the samba installation finshed, with log.nmdb saying "error opening config file", and no /etc/samba folder present at all. A retry of the purge-and-remove and reinstallation process resulted in the same again and again. – Frank H. Oct 14 '16 at 18:57
  • This is the ONLY working approach all over the internet! You save my day, thank you. – Evi Song Oct 23 '17 at 16:27
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
| improve this answer | |
0

Additionally to @Andrew answer, the recent upgrade from ubuntu 17.04 to 17.10 creates issues on the systemctl samba-dc-ad.service. Supposedly it's not a bug on the mask when you try to re-install samba on the samba-dc-ad.service (intensional). Steps in addition before @Andrew's answer, if you are having issues with samba install/re-install because of the upgrade:

  1. apt-get update & apt-get-upgrade <-- make sure no upgrades outstanding
  2. apt-get install samba
  3. go to this page and do the instructions: https://wiki.samba.org/index.php/Managing_the_Samba_AD_DC_Service_Using_Systemd

  4. apt-get -f install samba

  5. Do the above steps, now. :-)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.