1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Samba what am I doing wrong?

Discussion in 'Linux & Open Source' started by BigBoy, Apr 15, 2018.

  1. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    I have a Hyper-V Debian server running my pihole and want to make better use of the server, so I decided to see how well I could share from and to it, so following This guide I installed samba and set it up exactly as per the guide but I get the following error when I do /etc/init.d/samba status

    [​IMG]

    Any Idea what I've done wrong or what I need to change?

    Thanks.
     
  2. memyselfandi

    Sgarrista

    Joined: Oct 10, 2005

    Posts: 8,173

    Location: Nottingham

    No because you have no meaningful error messages there other than that the NMBD and SMBD processes haven't started (I would also note that from the messages the system appears to be using systemd so I am surprised you are using init scripts to start the service).

    Try running the two commands it mentions on the third line (starting "See") as well as posting your smb.conf file.
     
  3. pete910

    Wise Guy

    Joined: Oct 3, 2013

    Posts: 2,124

    Use systemctl for services ect. You can end up with some weird issues when mixing both

    Code:
    systemctl status nmbd.service
    systemctl status smbd.service
    journalctl -u nmbd.service
    journalctl -u smbd.service
    May shine more light on why it's failing

    Run testparm to check syntax ect of your smb.conf file too, may have errors.
     
  4. Sp00n

    Capodecina

    Joined: Oct 18, 2002

    Posts: 17,829

    Location: Brighton

    testparm smb.conf is your friend, if that doesn't throw up anything, check the logs.
     
  5. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    The SMB.conf is fine checked before starting services and it's all good, started the services independently and they work as they should, but I still cannot access the share, will post my conf in a sec.
     
  6. pete910

    Wise Guy

    Joined: Oct 3, 2013

    Posts: 2,124

    Check the perms/owner of the folder , if not set correctly it will prevent access
     
  7. Sp00n

    Capodecina

    Joined: Oct 18, 2002

    Posts: 17,829

    Location: Brighton

    What's in the logs?
     
  8. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    smb.conf is as follows
    Code:
    [global]
    workgroup = REGIMENT
    server role = standalone server
    
    [homes]
    comment = Home Directories
    browsable = yes
    writable = yes
    
    [public]
    path = /media/storage/
    public = yes
    writable = yes
    comment = Linux Share
    printable = no
    only guest = yes
    Permissions for /media/storage/ are 777
     
  9. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    [​IMG]
    [​IMG]
    [​IMG]
     
  10. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    If i try accessing the share from another machine this is what I get

    [​IMG]

    I cannot even mount it within the VM
     
  11. memyselfandi

    Sgarrista

    Joined: Oct 10, 2005

    Posts: 8,173

    Location: Nottingham

    Have you tried commenting the idmap line given that your share settings allow for guest access so you shouldn't need to authenticate so it shouldn't be needed?

    You also might want to add some logging lines to the global section to see if any more information is given out

    Code:
       
       log file = /var/log/samba/log.%m
       log level = 3
    
     
  12. Buffalo2102

    Hitman

    Joined: Jun 9, 2004

    Posts: 554

    Who is the owner of /media/storage?
     
  13. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    Will add the log lines later,

    /media/storage was created by user with sudo permissions, then chmod 777 on the folder.
     
  14. Buffalo2102

    Hitman

    Joined: Jun 9, 2004

    Posts: 554

    Do you want to use authentication for the share or just access it freely? I'm not an expert by any means but if you just want open access I think you will need to change the owner of the folder too. I believe that Windows uses nobody:nogroup.
     
  15. Buffalo2102

    Hitman

    Joined: Jun 9, 2004

    Posts: 554

    On my share I have the following:

    [storage]
    path = /storage
    browsable =yes
    writable = yes
    guest ok = yes
    public = yes
    read only = no
    create mask = 0777
    directory mask = 0777
    force user = raymond
    force group = raymond

    The shared folder is /storage (obviously) it's owner is raymond:raymond and permissions are 777.

    This requires that I enter the credentials for raymond the first time I access the share from Windows but everything just works after that.
     
  16. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    The log file line errors when I testparm
     
  17. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    Thanks will try similar conf later off to work now.
     
  18. BigBoy

    Soldato

    Joined: Oct 19, 2002

    Posts: 5,134

    Location: Bath

    Ok so I removed samba and reinstalled via apt-get and built a new conf using the advice here and it works straight away! dunno what was going on before tbh, just need a cron now to activate samba every time it boots.
     
  19. Buffalo2102

    Hitman

    Joined: Jun 9, 2004

    Posts: 554

    If you installed via apt, you shouldn't need a cron. It should already be enabled in systemd -
    sudo systemctl status smbd
    sudo systemctl status nmbd

    If they aren't enabled then -
    sudo systemctl enable smbd
    sudo systemctl enable nmbd

    Then reboot and samba should be running.
     
  20. PaulCa

    Associate

    Joined: May 3, 2018

    Posts: 66

    No, no, no, no.

    Nor this:
    create mask = 0777
    directory mask = 0777

    It's lazy, dumb and insecure.

    775, mask 775 is what you want. Really it should be 664 for files, 775 for directories. Not making files world executable is exactly how Linux has avoid viruses for so many years.