Results 1 to 10 of 610

Thread: Howto: Fix Windows share browsing issues

Threaded View

  1. #1
    Join Date
    Mar 2006
    Location
    Kitakyushu Japan
    Beans
    9,361
    Distro
    Ubuntu 11.04 Natty Narwhal

    Howto: Fix Windows share browsing issues

    Howto: Fix Windows share browsing issues

    First of all, even though it’s more difficult, manually mounting shares via /etc/fstab gives many advantages including faster speeds, more reliability, and larger file transfer sizes. It is more difficult to get things working properly, but once it’s done you never have to think about it again. So, if you’re willing to put forth a bit of effort for greater rewards than this tutorial will provide, please see the second link in my signature.

    Windows share browsing issues are somewhat complex in that even though your symptoms are exactly the same, the causes can be extremely different. In this howto, I will outline the five primary reasons for the problem, and provide fixes for each. Once you're finished, you should be able to browse and connect to Windows shares by clicking on "places" > "connect to server".

    That said, most problems are related to hostname resolution across the network. It's important to be aware that network name resolution can be a complex and daunting task to tackle and understand. The following outlines one way of potentially fixing this problem, but there are plenty of other techniques that work just as well or better depending on your network configuration. Here is a good example: http://ubuntuforums.org/showthread.php?t=1781455

    = = = = = = = = = = = = = = = = = = =

    Problem 1:
    Ubuntu sometimes has trouble browsing shares in workgroups that it is not a member of. It can help if you make sure that all the computers in your network belong to the same workgroup. However, even if this is not a problem it's not a bad idea (unless you have reason to do otherwise) to have your workgroup homogeneous because it can ease the difficulty of troubleshooting.

    By default, Ubuntu is a member of the “WORKGROUP” workgroup, but not all Windows computers use this convention. In order to correct this problem, you’ll need to verify that all your Windows computers belong to the same workgroup. In order to check/change that, please see this Microsoft support document: http://support.microsoft.com/kb/295017

    If you prefer to change Ubuntu's workgroup, please see "Problem 2".

    = = = = = = = = = = = = = = = = = = =

    Problem 2:
    To fix this problem will require some editing of configuration files via CLI. There are easier ways to change the workgroup that Ubuntu belongs to, but many of these methods also tend to cause other problems.

    The best and most reliable way to change Ubuntu's workgroup is by editing the /etc/samba/smb.conf file. This means that it may be easier to assign all of your Windows computers to the “WORKGROUP” workgroup (as outlined under "Problem 1"). Otherwise, use the following directions to edit /etc/samba/smb.conf in order to change the workgroup that Ubuntu is a member of.


    Problem 2 - part 1
    Open this file for editing with the following command:
    Code:
    gksudo gedit /etc/samba/smb.conf
    Scroll down to the section that looks like this:
    Code:
     #======================= Global Settings =======================
    
    [global]
    
    ## Browsing/Identification ###
    
    # Change this to the workgroup/NT-domain name your Samba server will part of
       workgroup = WORKGROUP
    Change “WORKGROUP” in “workgroup = WORKGROUP” to match your Windows workgroup.

    Problem 2 - part 2
    It may also help to add netbios name = computer-name just below "workgroup = WORKGROUP".

    Your "computer-name" can be anything, but common convention is to use the name you gave it when you installed Ubuntu (everything after the "@" symbol on the CLI prompt).

    For example, here's my CLI prompt:
    Code:
    dmizer@shinkansen:~$
    And here's my smb.conf file:
    Code:
    #======================= Global Settings =======================
    
    [global]
    
    ## Browsing/Identification ###
    
    # Change this to the workgroup/NT-domain name your Samba server will part of
       workgroup = WORKGROUP
       netbios name = shinkansen
    Now, save the file by clicking on "File" > "save", close gedit, and restart samba with the following command (Pre Jaunty):
    Code:
    sudo /etc/init.d/samba restart
    If, after running the above command, you see this error (Since Jaunty):
    Code:
    sudo: /etc/init.d/samba: command not found
    Use the following command (or reboot) instead:
    Code:
    sudo service smbd restart
    = = = = = = = = = = = = = = = = = = =

    Problem 3:
    Ubuntu is unable to reliably browse Windows host names by default. Enabling this ability will also require a conf file edit.

    ---CAUTION---
    If you are using Firestarter, uninstall it before making this edit. Firestarter may prevent the machine from booting after this change is made. Use GUFW instead.
    ---CAUTION---


    Problem 3 - Part 1
    Open /etc/nsswitch.conf for editing with the following command:
    Code:
    gksudo gedit /etc/nsswitch.conf
    Find the line that looks something like:
    Code:
    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
    For this line, order IS important. You’ll need to add the “wins” option before dns, so the line reads like this:
    Code:
     hosts:          files mdns4_minimal [NOTFOUND=return] wins dns mdns4
    Now, save the file by clicking on "File" > "save" and close gedit.

    Problem 3 - Part 2
    You'll also have to install the winbind daemon in order to resolve hostnames. This is easily done with the following command:
    Code:
    sudo apt-get install winbind
    Then, either restart networking or reboot.

    Problem 3 - Jaunty/Karmic
    Some Karmic users are reporting name resolution failure even after performing all the steps in this howto. If you have a local DNS server, do not perform this edit. Usually small home networks do not have a local DNS server but most office networks do. If you are unsure, talk to your office sysadmin. Either way, the following edit may solve some issues.

    Open /etc/samba/smb.conf for editing with the following command:
    Code:
    gksudo gedit /etc/samba/smb.conf
    Find the line that looks something like:
    Code:
    ;   name resolve order = lmhosts host wins bcast
    Just as with Problem 3 - Part 1, order is important when editing this line. You'll need to remove the semicolon, and move "host" to the end of the line so that it looks like this:
    Code:
       name resolve order = lmhosts wins bcast host
    Bug report here: https://bugs.launchpad.net/ubuntu/+s...ba/+bug/375593
    Thanks to audiomick for this information.


    = = = = = = = = = = = = = = = = = = =

    Problem 4:
    Firewalls block samba browsing. If you're sharing files over samba, that probably means you're on a LAN with only indirect (usually via a firewalled gateway/router) access to the Internet. This means that you probably don't need a firewall at all. If you think you DO need a firewall, you should really think about how wise it is to poke holes in it to facilitate samba file sharing.

    If you simply must have a firewall and have decided that it's a good idea to allow samba access through it, start by checking all of your Windows computers to make sure that your firewalls allow Samba browsing. Also, since Jaunty, Ubuntu has enabled the UFW by default. This interferes with network browsing. Finally, if you’ve installed Firestarter or any other firewall tools, you may run into this problem. To correct this, you’ll need to add rules to allow the following ports:
    • Port 137/UDP - used by nmbd
    • Port 138/UDP - used by nmbd
    • Port 139/TCP - used by smbd
    • Port 445/TCP - used by smbd


    First of all, determine if you have a firewall in place or not. To check for firewalls, run the following command:
    Code:
    sudo iptables -L
    A disabled firewall should look like this: http://pastebin.com/f564e1a42. If not, then you have a firewall enabled.

    If the UFW is enabled, here’s how to add UFW rules for samba browsing in Jaunty:
    Code:
    sudo ufw allow proto udp to any port 137 from 192.168.1.0/24
    sudo ufw allow proto udp to any port 138 from 192.168.1.0/24
    sudo ufw allow proto tcp to any port 139 from 192.168.1.0/24
    sudo ufw allow proto tcp to any port 445 from 192.168.1.0/24
    Make sure to change 192.168.29.0/24 so that it matches your own network IP range.

    Credit for the UFW edit goes here: http://ubuntuforums.org/showthread.php?t=1225549

    If you're using firestarter, uninstall it. The default firewall in Jaunty is UFW, you can manage it via it's GUI interface by installing gufw.

    = = = = = = = = = = = = = = = = = = =

    Problem 5:
    While sometimes share browsing problems can be caused by Ubuntu, some browsing problems are caused by the Windows machines on your network. Even if you cannot browse from Ubuntu but you can browse shares between Windows machines, the problem can still be a misconfiguration on your Windows computer.

    Here are three common problems with the configuration of your Windows computers.

    UAC drive protection:
    If your trying to connect to Vista or Win7, you may not be able to connect to any UAC protected drive/directory. Because of this, sharing entire drives will not give you access (unlike it did in XP). Believe me when I say ... this is a very good thing. You don't want your entire system hanging out there for all to see. It's possible to override this protection but I wouldn't advise it.

    Instead, share a single folder that your Vista user has control over (double check permissions). If you want an entire drive to be dedicated to sharing, then share the first folder on the drive and put everything else inside it like so:

    D:/ddrive-shared/Music
    D:/ddrive-shared/Movies
    D:/ddrive-shared/Pictures
    D:/ddrive-shared/Documents
    D:/ddrive-shared/Other
    etc

    More information here: http://www.vistax64.com/vista-securi...ss-denied.html
    Related Ubuntu discussion here: http://ubuntuforums.org/showthread.php?t=1176221

    Windows 7 configuration:
    First of all, remove Windows Live ID Sign-in assistant if you have it installed. More information here: http://social.technet.microsoft.com/...a-0d79a5597527

    Windows 7 seems to be bent on wanting you to use "HomeGroup" file sharing, but this will not work with Samba, it will only work with other Windows 7 computers, and you're probably better off disabling it if you need things to work correctly in a mixed network.

    In order to get simple file sharing to work, you'll need to click on the "Change advanced sharing settings", and make sure you have network discovery, file and printer sharing, and public folder sharing enabled in the "home or work" profile (also, make sure that "home or work" is labeled as your current profile). You should be able to use 128 bit encryption, and use either enable or disable password protected shares (depending on how much security you desire).

    Then, go to "Change adapter settings", right click on your connection and select "properties". Click on the "Internet protocol version 4 (tcp/ipv4)" and select "properties". Then click on "advanced ..." (at the bottom), and select the "WINS" tab. Make sure that "Enable LMHOSTS lookup" is enabled (no need to import), and make sure that "default" is selected for NetBIOS setting.

    Now, go to a folder (try the public folder first), and right click on it. Select "properties", and click on the "sharing" tab. Click on "Advanced sharing", and put a check mark in "Share this folder". Change the "share name" if you like, and click on the "permissions" button. Make sure you have permissions set as you desire (a checkmark in "change" = writeable). If you've enabled password protected shares, you'll have to tweak settings here to make sure that your Ubuntu user is included for permission.

    In some situations, you will find it necessary to add your Ubuntu username and password as an account on your Win7 machine. This may seem tedious, but that's the way secure Samba servers work.

    Once this is all set, then your folder will show "shared" and it's network path will be displayed.

    Failed to retrieve share list from server:
    If you have addressed all of the above fixes and you still get the "Unable to mount location: Failed to retrieve share list from server" error message when trying to browse your network, this may be related to Windows "Event ID 2011".

    Please see the fix noted here: http://support.microsoft.com/kb/177078
    Huge thanks to mickeythemoke for finding this.

    = = = = = = = = = = = = = = = = = = =

    If you have addressed all of the above issues, and you are still unable to browse Windows shares, you may have more luck and better results by following the CIFS tutorial in my sig. Otherwise, feel free to post here and I'll do what I can to help resolve the problem.

    ------
    version history:
    2009-06-04: Included Vista specific information
    2009-06-20: Updated UFW configuration
    2009-06-25: Included directions for verifying firewalls
    2009-07-29: Changed UFW firewall rules to reflect findings given in this thread: http://ubuntuforums.org/showthread.php?t=1225549(incorrect)
    2009-08-05: Removed name resolve order edit from problem 2 as it could possibly conflict with the winbind daemon.
    2009-08-20: Corrected UFW rules per this post: http://ubuntuforums.org/showpost.php...&postcount=133
    2009-10-29: Included "name resolve order" option edit per this post: http://ubuntuforums.org/showpost.php...ey are needed.
    2010-02-03: Added Windows 7 configuration instructions
    2010-02-10: Added information regarding Windows Live ID Sign-in assistant.
    2010-02-25: Added more Win7 specific information regarding user accounts.
    2010-08-14: Removed wording which indicated that it was necessary to have all computers in the network under the same workgroup.
    2010-08-30: Updated samba restart command to include the service command used since Jaunty.
    2011-02-11: Added fix for "failed to retrieve share list from server" per this post: http://ubuntuforums.org/showpost.php...&postcount=490
    2011-06-24: Updated the introduction to mention and include alternative solutions.
    Last edited by dmizer; June 23rd, 2011 at 04:10 PM. Reason: See "version history"

Tags for this Thread

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
  •