Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Samba shares not accessible - restart fix

  1. #1
    Join Date
    Aug 2009
    Beans
    80
    Distro
    Ubuntu 11.04 Natty Narwhal

    Samba shares not accessible - restart fix

    Since the latest update for Maverick (about a week ago) my samba isn't working right. I tried updating to Natty and I'm still having the same problems.

    Symptoms:
    Other PC's (including: a couple windows systems (xp and vista), a couple old xboxes (with xbmc), one other ubuntu machine running Maverick) are having problems connecting to my server shares. It seems that after my server is running for a period of time (amount of time not determined) others cannot connect to it's shares. However, after reboots or restarting samba, everything kicks back in and people can read from my shares again.

    Work Around:
    As already mentioned, if i restart my server or just restart samba with:

    sudo service smbd restart
    Everything seems to work. And as long as people are connected and using the shares there isn't a problem (fast speeds, good sharing all around, no disconnects)

    Here's my full but censored smb.conf:

    [global]
    ; netbios name = <censored: it's first initial and last name. eg. jdoe>
    server string = Samba file and print server
    workgroup = <censored: one word, not a reserved word>
    security = share
    hosts allow = 127. 192.168.0.
    interfaces = 127.0.0.1/8 192.168.0.0/24
    bind interfaces only = yes
    remote announce = 192.168.0.255
    remote browse sync = 192.168.0.255
    printcap name = cups
    ; load printers = yes
    cups options = raw
    ; printing = cups
    ; guest account = nobody
    log file = /var/log/samba/samba.log
    max log size = 1000
    ; null passwords = no
    username level = 6
    password level = 6
    ; encrypt passwords = yes
    unix password sync = yes
    socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    local master = no
    domain master = no
    ; preferred master = no
    ; domain logons = no
    os level = 33
    logon drive = m:
    logon home = \\%L\homes\%u
    logon path = \\%L\profiles\%u
    logon script = %G.bat
    ; time server = no
    name resolve order = wins lmhosts bcast
    ; wins support = no
    ; wins proxy = no
    dns proxy = no
    ; preserve case = yes
    ; short preserve case = yes
    client use spnego = no
    client signing = no
    client schannel = no
    ; server signing = no
    server schannel = no
    ; nt pipe support = yes
    ; nt status support = yes
    allow trusted domains = no
    obey pam restrictions = yes
    ; enable spoolss = yes
    ; client plaintext auth = no
    ; disable netbios = no
    follow symlinks = no
    update encrypted = yes
    ; pam password change = no
    passwd chat timeout = 120
    ; hostname lookups = no
    ; passdb backend = tdbsam
    passwd program = /usr/bin/passwd '%u'
    passwd chat = *New*password* %n\n *ReType*new*password* %n\n *passwd*changed*\n
    add user script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null '%u'
    add user to group script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null -g '%g' '%u'
    add group script = /usr/sbin/groupadd '%g'
    delete user script = /usr/sbin/userdel '%u'
    delete user from group script = /usr/sbin/userdel '%u' '%g'
    delete group script = /usr/sbin/groupdel '%g'
    add machine script = /usr/sbin/useradd -d /dev/null -g sambamachines -c 'Samba Machine Account' -s /dev/null -M '%u'
    machine password timeout = 120
    idmap uid = 16777216-33554431
    idmap gid = 16777216-33554431
    template shell = /dev/null
    winbind use default domain = yes
    winbind separator = @
    winbind cache time = 360
    winbind trusted domains only = yes
    winbind nested groups = no
    winbind nss info = no
    ; winbind refresh tickets = no
    ; winbind offline logon = no
    ; guest ok = no

    [homes]
    comment = Home Directories
    path = /home
    read only = no
    ; available = yes
    ; browseable = yes
    ; guest ok = no
    ; printable = no
    locking = no
    strict locking = no

    [netlogon]
    comment = Network Logon Service
    path = /home/netlogon
    read only = no
    ; available = yes
    ; browseable = yes
    ; guest ok = no
    ; printable = no
    locking = no
    strict locking = no

    [profiles]
    comment = User Profiles
    path = /var/samba/profiles
    read only = no
    ; available = yes
    browseable = no
    ; guest ok = no
    ; printable = no
    create mode = 0600
    directory mask = 0700
    locking = no
    strict locking = no

    [printers]
    comment = All Printers
    path = /var/spool/samba
    ; browseable = yes
    ; writable = No
    ; guest ok = no
    printable = yes
    locking = no
    strict locking = no

    [pdf-documents]
    path = /home/pdf-documents
    comment = Converted PDF Documents
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [pdf-printer]
    path = /tmp
    comment = PDF Printer Service
    printable = yes
    guest ok = yes
    use client driver = yes
    printing = bsd
    print command = /usr/bin/gadmin-samba-pdf %s %u
    lpq command =
    lprm command =

    [video]
    path = /media/data/video
    comment = Videos
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [music]
    path = /media/data/music
    comment = Music
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [software]
    path = /media/data/software
    comment = Software
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [shared]
    path = /media/data/shared
    comment = Public Share
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no
    It seems to time out. What could be my problem?

    There's one line:

    machine password timeout = 120
    That kinda bugs me but that's a password timeout, not a sharing timeout. Or am I wrong?

  2. #2
    Join Date
    Aug 2009
    Beans
    80
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Samba shares not accessible - restart fix

    I have a better idea of what's happening now. It's not timing out as I first thought.

    When I first start or reboot my computer samba shares are not accessable.

    All I have to do to get things going again is:

    sudo service smbd restart
    I am not running wicd. I'm running the regular old network manager.

    I've played around with my smb.conf to see if that made any difference, it doesn't but I'll post it here anyway.

    [global]
    netbios name = <censored>
    server string = Samba file and print server
    workgroup = <censored>
    security = share
    hosts allow = 127. 192.168.0.
    interfaces = 127.0.0.1/8 192.168.0.0/24
    bind interfaces only = yes
    remote announce = 192.168.0.255
    remote browse sync = 192.168.0.255
    printcap name = cups
    ; load printers = yes
    cups options = raw
    ; printing = cups
    ; guest account = nobody
    log file = /var/log/samba/samba.log
    max log size = 1000
    ; null passwords = no
    username level = 6
    password level = 6
    ; encrypt passwords = yes
    unix password sync = yes
    socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    local master = no
    domain master = no
    ; preferred master = no
    ; domain logons = no
    os level = 33
    logon drive = m:
    logon home = \\%L\homes\%u
    logon path = \\%L\profiles\%u
    logon script = %G.bat
    ; time server = no
    name resolve order = wins lmhosts bcast
    ; wins support = no
    ; wins proxy = no
    dns proxy = no
    ; preserve case = yes
    ; short preserve case = yes
    client use spnego = no
    client signing = no
    client schannel = no
    ; server signing = no
    server schannel = no
    ; nt pipe support = yes
    ; nt status support = yes
    allow trusted domains = no
    obey pam restrictions = yes
    ; enable spoolss = yes
    ; client plaintext auth = no
    ; disable netbios = no
    follow symlinks = no
    update encrypted = yes
    ; pam password change = no
    passwd chat timeout = 120
    ; hostname lookups = no
    ; passdb backend = tdbsam
    passwd program = /usr/bin/passwd '%u'
    passwd chat = *New*password* %n\n *ReType*new*password* %n\n *passwd*changed*\n
    add user script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null '%u'
    add user to group script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null -g '%g' '%u'
    add group script = /usr/sbin/groupadd '%g'
    delete user script = /usr/sbin/userdel '%u'
    delete user from group script = /usr/sbin/userdel '%u' '%g'
    delete group script = /usr/sbin/groupdel '%g'
    add machine script = /usr/sbin/useradd -d /dev/null -g sambamachines -c 'Samba Machine Account' -s /dev/null -M '%u'
    machine password timeout = 120
    idmap uid = 16777216-33554431
    idmap gid = 16777216-33554431
    template shell = /dev/null
    winbind use default domain = yes
    winbind separator = @
    winbind cache time = 360
    winbind trusted domains only = yes
    winbind nested groups = no
    winbind nss info = no
    ; winbind refresh tickets = no
    ; winbind offline logon = no
    ; guest ok = no

    [homes]
    comment = Home Directories
    path = /home
    read only = no
    ; available = yes
    ; browseable = yes
    ; guest ok = no
    ; printable = no
    locking = no
    strict locking = no

    [netlogon]
    comment = Network Logon Service
    path = /home/netlogon
    read only = no
    ; available = yes
    ; browseable = yes
    ; guest ok = no
    ; printable = no
    locking = no
    strict locking = no

    [profiles]
    comment = User Profiles
    path = /var/samba/profiles
    read only = no
    ; available = yes
    browseable = no
    ; guest ok = no
    ; printable = no
    create mode = 0600
    directory mask = 0700
    locking = no
    strict locking = no

    [printers]
    comment = All Printers
    path = /var/spool/samba
    ; browseable = yes
    ; writable = No
    ; guest ok = no
    printable = yes
    locking = no
    strict locking = no

    [pdf-documents]
    path = /home/pdf-documents
    comment = Converted PDF Documents
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [pdf-printer]
    path = /tmp
    comment = PDF Printer Service
    printable = yes
    guest ok = yes
    use client driver = yes
    printing = bsd
    print command = /usr/bin/gadmin-samba-pdf %s %u
    lpq command =
    lprm command =

    [video]
    path = /media/data/video
    comment = Videos
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [music]
    path = /media/data/music
    comment = Music
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [software]
    path = /media/data/software
    comment = Software
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no

    [shared]
    path = /media/data/shared
    comment = Public Share
    ; available = yes
    ; browseable = yes
    writeable = yes
    guest ok = yes
    locking = no
    strict locking = no
    Any ideas?

    Is there a log file that might help me with this? How can i filter dmesg to only show samba stuff?

    Thanks.

  3. #3
    Join Date
    Aug 2009
    Beans
    80
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Samba shares not accessible - restart fix

    Sorry for bumping again.

    To summarize the problem: After a boot or reboot I cannot access my samba shares.

    If I run:

    Code:
    sudo service smbd restart
    Everything works fine until my next boot/reboot.

    I cleared out my samba.log and rebooted. Here are the full contents of the log file.

    Code:
    [2011/05/18 20:15:46.105451,  1] smbd/service.c:1251(close_cnum)
      192.168.0.199 (192.168.0.199) closed connection to service video
    [2011/05/18 20:15:46.106203,  1] smbd/service.c:1251(close_cnum)
      192.168.0.101 (192.168.0.101) closed connection to service video
    [2011/05/18 20:15:46.109027,  1] smbd/service.c:1251(close_cnum)
      192.168.0.199 (192.168.0.199) closed connection to service video
    [2011/05/18 20:16:33.318367,  0] printing/print_cups.c:108(cups_connect)
      Unable to connect to CUPS server localhost:631 - Connection refused
    [2011/05/18 20:16:33.353070,  0] printing/print_cups.c:108(cups_connect)
      Unable to connect to CUPS server localhost:631 - Connection refused
    [2011/05/18 20:16:33.354574,  0] smbd/server.c:1169(main)
      standard input is not a socket, assuming -D option
    [2011/05/18 20:16:35.090507,  0] winbindd/winbindd_cache.c:3076(initialize_winbindd_cache)
      initialize_winbindd_cache: clearing cache and re-creating with version number 1
    Why is it saying connection closed and connection refused? On my xbox it says "Cannot connect to network server".

    After:
    Code:
     sudo service smbd restart
    The log says:

    Code:
    [2011/05/18 20:26:02.100574,  0] winbindd/winbindd_cache.c:3076(initialize_winbindd_cache)
      initialize_winbindd_cache: clearing cache and re-creating with version number 1
    [2011/05/18 20:35:52.053530,  0] smbd/server.c:1169(main)
      standard input is not a socket, assuming -D option
    [2011/05/18 20:36:00.518143,  1] smbd/service.c:1070(make_connection_snum)
      192.168.0.199 (192.168.0.199) connect to service video initially as user nobody (uid=65534, gid=65534) (pid 1849)
    Then everything works fine again. So frustrating.

  4. #4
    Join Date
    Dec 2008
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba shares not accessible - restart fix

    Quote Originally Posted by atomicben View Post
    Sorry for bumping again.

    To summarize the problem: After a boot or reboot I cannot access my samba shares.

    If I run:

    Code:
    sudo service smbd restart
    Everything works fine until my next boot/reboot.

    I cleared out my samba.log and rebooted. Here are the full contents of the log file.

    Code:
    [2011/05/18 20:15:46.105451,  1] smbd/service.c:1251(close_cnum)
      192.168.0.199 (192.168.0.199) closed connection to service video
    [2011/05/18 20:15:46.106203,  1] smbd/service.c:1251(close_cnum)
      192.168.0.101 (192.168.0.101) closed connection to service video
    [2011/05/18 20:15:46.109027,  1] smbd/service.c:1251(close_cnum)
      192.168.0.199 (192.168.0.199) closed connection to service video
    [2011/05/18 20:16:33.318367,  0] printing/print_cups.c:108(cups_connect)
      Unable to connect to CUPS server localhost:631 - Connection refused
    [2011/05/18 20:16:33.353070,  0] printing/print_cups.c:108(cups_connect)
      Unable to connect to CUPS server localhost:631 - Connection refused
    [2011/05/18 20:16:33.354574,  0] smbd/server.c:1169(main)
      standard input is not a socket, assuming -D option
    [2011/05/18 20:16:35.090507,  0] winbindd/winbindd_cache.c:3076(initialize_winbindd_cache)
      initialize_winbindd_cache: clearing cache and re-creating with version number 1
    Why is it saying connection closed and connection refused? On my xbox it says "Cannot connect to network server".

    After:
    Code:
     sudo service smbd restart
    The log says:

    Code:
    [2011/05/18 20:26:02.100574,  0] winbindd/winbindd_cache.c:3076(initialize_winbindd_cache)
      initialize_winbindd_cache: clearing cache and re-creating with version number 1
    [2011/05/18 20:35:52.053530,  0] smbd/server.c:1169(main)
      standard input is not a socket, assuming -D option
    [2011/05/18 20:36:00.518143,  1] smbd/service.c:1070(make_connection_snum)
      192.168.0.199 (192.168.0.199) connect to service video initially as user nobody (uid=65534, gid=65534) (pid 1849)
    Then everything works fine again. So frustrating.
    I just have to ask. Are you running this at home using a workgroup with local logins; or is this a domain login setup with AD in the mix?

    I see little details in your smb.conf that are incorrect, but the major factors are dependent on the environment the Samba (smbd and nmbd) operates in.

  5. #5
    Join Date
    Aug 2009
    Beans
    80
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Samba shares not accessible - restart fix

    Not a domain or active directory setup. Just a local workgroup.

    The smb.conf had previously only been edited by the samba GUI (I also tried gadmin samba gui). It's only now I'm starting to take matters into my own hands with the smb.conf.

    Any advice you have is appreciated.

  6. #6
    Join Date
    Dec 2008
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba shares not accessible - restart fix

    Quote Originally Posted by atomicben View Post
    Not a domain or active directory setup. Just a local workgroup.

    The smb.conf had previously only been edited by the samba GUI (I also tried gadmin samba gui). It's only now I'm starting to take matters into my own hands with the smb.conf.

    Any advice you have is appreciated.
    There is no need for Winbind in a workgroup situation.
    "Winbind uses a UNIX implementation of Microsoft RPC calls, Pluggable Authentication Modules (PAMs), and the name service switch (NSS) to allow Windows NT domain users to appear and operate as UNIX users on a UNIX machine." ... "Winbind maintains a database called winbind_idmap.tdb in which it stores mappings between UNIX UIDs, GIDs, and NT SIDs. This mapping is used only for users and groups that do not have a local UID/GID."
    As you are running only local logins and have no need to integrate into a Windows domain situation you should remove winbind altogether as a first step.
    Code:
    sudo apt-get purge winbind
    Next you need to edit the /etc/nsswitch.conf file back to original if you have molested it in any way.

    Do you have LAN side DNS or some method of resolving DNS hostnames locally? You need to be able to do that. There is no need to worry about NetBIOS name resolution as the Samba nmbd daemon will convert DNS hostnames to NetBIOS names for Samba.

    The next step is to start over with a new smb.conf file. Did you make a copy the original smb.conf file? I usually do this before I modify a system file. That way if I have to revert back to the original file, I have the file in the same directory.
    Code:
    cp <conf.file> <conf.file.original
    If you did not, the original file exists at
    Code:
    /usr/share/samba/smb.conf
    Any user login should from a windows host should also be a local user on the Ubuntu host. All the workgroup users also need to be in the smbpasswd data base.
    Code:
    sudo smbpasswd -a
    With the original smb.conf file in place and confirmed working local DNS resolution (hosts or DNS), along with Samba users in the smbpasswd database, you can start to add back the shares. The only thing other than the shares you need to edit is the WORKGROUP name. All the other default parameters are fine just the way they are.

    In short you need to do these steps:
    • Remove winbind from the system
    • Provide DNS name resolution for LAN
    • Create Ubuntu users
    • Create Samba users (populate the smbpasswd database)
    • Revert to a clean copy of the /etc/samba/smb.conf file
    • Add WORKGROUP name and shares to smb.conf
    • Add your shares


    This is a good guide. It assumes you have DNS resolution working.
    Last edited by capscrew; May 19th, 2011 at 07:10 PM.

  7. #7
    Join Date
    Aug 2009
    Beans
    80
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Samba shares not accessible - restart fix

    Wow, thanks for the amazing reply.

    I do not have a LAN side DNS or hosts file. Never needed one before. I've always been able to connect to samba through \\servername\sharename

    I'm confused why doing a 'service smbd restart' works but it doesn't on boot. I'd imagine that if there was a bad setting (or more) it would fail in every situation. That's why this has been such an annoying problem.

    I will follow your steps and let you know what happens.
    Last edited by atomicben; May 19th, 2011 at 06:46 PM.

  8. #8
    Join Date
    Dec 2008
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba shares not accessible - restart fix

    Quote Originally Posted by atomicben View Post
    Wow, thanks for the amazing reply.

    I do not have a LAN side DNS or hosts file. Never needed one before. I've always been able to connect to samba through \\servername\sharename
    Except when you have trouble.

    I'm confused why doing a 'service smbd restart' works but it doesn't on boot. I'd imagine that if there was a bad setting (or more) it would fail in every situation. That's why this has been such an annoying problem.

    I will follow your steps and let you know what happens.
    You should not rely on winbind to provide you with name resolution. This is what you are doing (e.g name resolution). It can create bizarre reactions. I have used the steps I provided you hundreds of times. They work and are consistent with the Samba developers intentions.

    You MUST provide hosts/DNS for your Ubuntu machine. This can be as simple as editing the /etc/hosts file and adding all the hosts in the LAN. Post the output here of the /etc/hosts file you propose to use.

  9. #9
    Join Date
    Aug 2009
    Beans
    80
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Samba shares not accessible - restart fix

    capscrew,

    Everything is back to normal! I don't know exactly which step(s) fixed it (I hate that) but I'll tell you what I did.

    I purged winbind with:

    Code:
    sudo apt-get purge winbind
    I looked at the /etc/nsswitch.conf file but since I had never molested (or even heard of) it I left it be.

    Although I always make a copy of a file before I molest it I grabbed
    Code:
    /usr/share/samba/smb.conf
    instead of trusting my backup. BTW, I never even knew that existed so extra thanks for that tip!

    Other Notes:

    • I did not do anything for a DNS solution - didn't touch the hosts file.


    • ******* users/passwords were already existing on my Ubuntu machine/Samba Server.

    Other Happy-endings:
    My main ubuntu box could never see this other ubuntu box. All of a sudden that kicked in! Weird...

    I'm betting that is was the winbind deal that was messing this up because I had purged and re-installed Samba a few times while troubleshooting and that didn't work so, anyway...

    Thank you very much for taking the time to reply and for providing such concise instruction.

    Happy May two-four! Have a good weekend.

  10. #10
    Join Date
    Dec 2008
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba shares not accessible - restart fix

    Quote Originally Posted by atomicben View Post
    capscrew,

    Everything is back to normal! I don't know exactly which step(s) fixed it (I hate that) but I'll tell you what I did.

    I purged winbind with:

    Code:
    sudo apt-get purge winbind
    I looked at the /etc/nsswitch.conf file but since I had never molested (or even heard of) it I left it be.

    Although I always make a copy of a file before I molest it I grabbed
    Code:
    /usr/share/samba/smb.conf
    instead of trusting my backup. BTW, I never even knew that existed so extra thanks for that tip!

    Other Notes:

    • I did not do anything for a DNS solution - didn't touch the hosts file.


    • ******* users/passwords were already existing on my Ubuntu machine/Samba Server.

    Other Happy-endings:
    My main ubuntu box could never see this other ubuntu box. All of a sudden that kicked in! Weird...

    I'm betting that is was the winbind deal that was messing this up because I had purged and re-installed Samba a few times while troubleshooting and that didn't work so, anyway...

    Thank you very much for taking the time to reply and for providing such concise instruction.

    Happy May two-four! Have a good weekend.
    Great to hear that all is well. Yes winbind messes up lots of things when it is misapplied. I'll bet your router provides some type of local nameservices (DNS). Anyway it all works and that is the main thing

    FYI -- Unless you corrupt the actual smbd or nmbd dasmons you only need to copy the spare smb.conf over to start again. There should be no need to reinstall Samba most of the time.

    You have a great weekend too.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •