Win10, Linux, mDNS, and Samba File Sharing

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
altair4
Level 18
Level 18
Posts: 8994
Joined: Tue Feb 03, 2009 10:27 am

Win10, Linux, mDNS, and Samba File Sharing

Post by altair4 » Sat Jul 11, 2015 7:39 am

Win10, Linux, mDNS, and Samba File Sharing
Note: This Howto has 3 parts.

Samba is used in Linux to share files with Linux, Windows, and OSX and has traditionally been made up of two parts:

smbd = the actual file sharing part which works reasonably well.
nmbd = the host discovery and machine name resolution part which represents most of the problems people face in working with Samba. It's a complicated thing with many rules.

In an all Linux or Linux / OSX network you can bypass the nmbd part with something else called mDNS or Avahi ( Bonjour in OSX ). OSX can broadcast it's samba shares to other Apple products and Linux can be set up to do the same but Microsoft never implemented mDNS in any of it's products.

This changed on July 2, 2015 with the release of Build 10162 of Windows 10. Win10 now has native support for mDNS but it has limitations. It doesn't announce it's presence like OSX does naturally or Linux can be made to do nor can it browse for or discover the announcements of others but it can access and be accessed explicitly:

[Part 1] Connecting to a Linux Samba server with an mDNS qualified host name works out of the box in Win10:

Open Run in Windows ( Windows Key + R ) and enter the Linux mDNS qualified host name like this:

Code: Select all

\\hostname.local
For example:
Connect-from-Run.png
Windows Explorer will instantly open up to that location:
Explorer-Result-From-Run.png
And you can map a particular share at that point if you wish: Right click a shared folder > Map network drive:
Map-a-shared-folder.png
Last edited by altair4 on Tue Apr 18, 2017 6:48 am, edited 10 times in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

altair4
Level 18
Level 18
Posts: 8994
Joined: Tue Feb 03, 2009 10:27 am

Re: Win10, Linux, mDNS, and Samba File Sharing

Post by altair4 » Sat Jul 11, 2015 7:43 am

[Part 2] Connecting to a Win10 box with its mDNS qualified host name is also possible but you need to add a Windows Firewall Rule:

Update:: Windows made this a little easier to set up in Win10:
Control Panel > Windows Defender Firewall > Allow an app or feature through Windows Defender Firewall > Change Settings. Then enable:

File and Printer Sharing ---> Private
mDNS -- Private

This should no longer be necessary:
Right Click the Start Button > Control Panel > System and Security > Windows Firewall > Advanced Settings > Inbound Rules > New Rule

Rule Type: Port
Protocol: UDP
Specific local ports: 5353
Action: Allow the connection
Profile: Private
Name: Allow mDNS for Samba on Private Network
*** On Linux open you your file manager and connect to the share using the Windows mDNS qualified host name:

Code: Select all

smb://vwin10.local
*** Or you can use Alt+F2 to open run and enter:

Code: Select all

nemo smb://vwin10.local
Win-fromLinux.png
Nemo ( in this case ) opens up to the Windows shares I created:
Nemo-Win10-Shares.png
At this point you can also "map" the Windows share by creating a Bookmark to the network location.

Win10 / Linux samba file sharing may work for you without all this but if you have issues with it this mDNS method is another way.
Last edited by altair4 on Fri Feb 09, 2018 3:43 pm, edited 3 times in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

altair4
Level 18
Level 18
Posts: 8994
Joined: Tue Feb 03, 2009 10:27 am

Re: Win10, Linux, mDNS, and Samba File Sharing

Post by altair4 » Wed Aug 05, 2015 1:47 pm

[Part 3] Providing Microsoft Account credentials when accessing a Win10 shared Folder.

If you installed Windows using a Microsoft Account rather than a local account you may have noticed that there's a problem with passing a username and password to Windows to access it's shares. You have two options:

[1] You can pass the Microsoft Account credentials you just have to do it a different way:

As an example let's say your Microsoft login to Win10 is: altair@something.com

When you connect to the shared folder from Linux you need to pass credentials this way:
Win10SMBCredentials.png
Username = altair
Domain = something.com ( or hotmail.com or live.com or whatever.com )
Password = your Win10 login password

And a manual mount takes a form something like this:

Code: Select all

sudo mount -t cifs //vwin10.local/shared /TestCIFSMount -o username=altair,password=win10password,domain=something.com,uid=1000

[2] Create a separate local user in Win10 for use only with samba:

Right click the Start Button > Computer Management > Local Users and Groups > Users > More Actions > New User:

Username: smbuser
Unselect: User must change password at next login
Select: User cannot change password
Select: Password never expires

Then when Windows asks for credentials pass smbuser's credentials.
Last edited by altair4 on Wed Nov 18, 2015 1:22 pm, edited 1 time in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

kwisher
Level 5
Level 5
Posts: 781
Joined: Wed Mar 05, 2008 12:54 pm
Location: Greentown, Indiana USA

Re: Win10, Linux, mDNS, and Samba File Sharing

Post by kwisher » Wed Aug 05, 2015 3:41 pm

Great post :) Thanks for the info!
The instructions suggested Windows XP or better, so I installed Linux :)

DEcosse
Level 1
Level 1
Posts: 37
Joined: Wed Feb 12, 2014 4:32 pm

Re: Win10, Linux, mDNS, and Samba File Sharing

Post by DEcosse » Tue Aug 18, 2015 2:46 am

AMAZING post - Thank you!!!!

No matter what I tried, I could not access my Win10 shares - my access was simply not recognized
By applying part 3 [2} and creating another user, all is good!

Mitch26
Level 1
Level 1
Posts: 15
Joined: Mon Aug 24, 2015 5:13 am

Re: Win10, Linux, mDNS, and Samba File Sharing

Post by Mitch26 » Fri Sep 18, 2015 10:52 am

Hi, I can connect to the files on my windows PC from my LinuxMint Rafaela PC but not the reverse. I have tried all the possible solutions given in the posts of this topic without success. I have left the smb.conf file as I had found it. Any other suggestions ?

altair4
Level 18
Level 18
Posts: 8994
Joined: Tue Feb 03, 2009 10:27 am

Re: Win10, Linux, mDNS, and Samba File Sharing

Post by altair4 » Fri Sep 18, 2015 11:39 am

Yes, Start a new and separate topic in the Networking section of the forum since it has nothing to do with this HowTo.

When you do post the output of these commands:

Code: Select all

testparm -s

Code: Select all

net usershare info --long

Code: Select all

sudo service avahi-daemon status
And tell us what DE you are using: Cinnamon, MATE, XFCE, or the other one .... um .... KDE.

And tell us what error message Windows is giving you when you try to access the share.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Post Reply

Return to “Tutorials”