Connecting Ubuntu to Windows shares and DFS trees

I wanted to access a full DFS tree of shared folders from my Windows Server 2008R2 network from an Ubuntu Linux 12.04 machine running on the same network.

My first attempt at using “sudo mount –t cifs …blah-blah-blah… “ simply would not work. Sometimes it *seemed* to connect, but the folders were always empty. I wasted hours trying to figure out how to solve this.

Here is the original post I made on asking for help, back in March 2012:

I never solved the problem, that is, until I tried again in October 2012. I’m now running Ubuntu 12.04. So, I started all over… I tried a bunch of things from Google… And I finally got it working, even from “Connect to Server” in Nautilus!!!

These are the steps that finally made it work:

1. Enable/configure  proper WINS resolution

Follow this discussion to enable WINS resolution of Windows computer names on the network

Basically, it boils down to making this change:


2. Install SMBFS and KeyUtils

Every time I tried to call the MOUNT command, I was getting some error like “cifs_mount failed w/ return code = -22” that I could see by running dmesg | tail

So, some posts lead me to install these things:



Some posts state that the Samba stuff on Ubuntu is now deprecated or replaced by the newer CIFS stuff, and for some things, CIFS is the only thing needed,  but I assure you that the original Samba package is also required to connect to a DFS tree on a Windows server.

You will notice that “smbfs” will also install “cifs-utils” if it’s not already installed.

3. Configure smb.conf

I also made a few tweaks in /etc/samba/smb.conf. Uncomment these lines, and enter the correct values for your network:



4. Finally – a very important discovery…

This is the magic that finally made this work for me!!! Changing one little parameter…

I happened to notice this teensy little difference in one of my files compared to a blog post referenced in the only reply to my original question on SeverFault.

In the /etc/request-key.conf, I changed this line:

to this:

Note: This file is created by the  “keyutils” install. It was not present before, as I looked for it. I noticed that it appeared after installing keyutils via apt-get.

Two things to note here…

1. According to, the –c option is deprecated and is currently ignored. So, I don’t know why that option is included in the file in first place.

2. Warning: The suggested –t option has something to do with “trusting” the DNS server to resolve and retrieve kerberos session keys. I really don’t understand what it all means, but it is explained in the link listed right above here. All I know is, from my trial-and-error testing, this allows Windows DFS tree mounting to work, and it DOES NOT work without –t on this one line.

So, read the above link to learn more about this and make sure it’s safe for your environment. I tried several times to make it work without the –t option, but whenever it connected It gave me folder names from the DFS tree, but they were empty when viewed in Nautilus.

You need to restart your terminal window after making these changes and before going to the final step below:

Finally, let’s connect to a DFS tree or any other shared folder on the server.

Open a new Terminal window, and type the following:

The –verbose option adds logging info about the mount, which you can read from this command:

Or, from Nautilus file browser, you can use “Connect to Server” from the File menu, and make these entries in the dialog window:


Kaboom!!! It worked. At least for me.

Good luck to others who need this.

19 thoughts on “Connecting Ubuntu to Windows shares and DFS trees”

  1. Thanks for your help, this was so helpful, I was trying to do this for 3 months and nothing worked.

  2. As of Ubuntu 14.04.1 LTS, trying to install smbfs yeilds “Package smbfs is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source. However the following packages replace it:
    cifs-utils:i386 cifs-utils
    E: Package ‘smbfs’ has no installation candidate

    Even without this, am able to get a windows DFS share to mount, but cannot actually traverse folders or see files, just get “Invalid Argument”.

  3. It worked, though very strangely for me… once it mounts successfully, another time it just fails with “cifs_mount failed w/return code = -6” error. The only workaround I could find is to replace “servername” with the server’s (domain controller in my case) actual IP address.

    Hope it helps someone.

  4. with kubuntu 14.04 this worked very fine for me.
    now i have a new install of kubuntu 16.04 and this doesn’t work… 🙁

  5. Man, you are the best!!! I’ve lost much time and found solution only here, in your site! Thank you very, very much!

  6. works fine for me as well! thank you very much!!
    I had to replace the “smbfs” package with “cifs-utils” on 16.04 LTS (just like Xeiran wrote..)

    note: small typo in the smb.conf. It should be “hosts” instead of “host” at the last line..

  7. Since this turns up in searches I’ll add a 2020 post for Ubuntu 20.04 and a Windows server 2019 DFS share

    Nautilus worked out of the box, nice.

    For a cifs-mount I just had to apt install keyutils and cifs-utils. No further configurations needed from me.

    Then I had success with this. I left out –verbose as it spat out an error:
    mount -t cifs //domainname.local/DFS-SHARE /mnt/temp -o username=MyUserAccount,password=*******,workgroup=DOMAINNAME.LOCAL

Leave a Reply

Your email address will not be published. Required fields are marked *