Windows10 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 19
Level 19
Posts: 9633
Joined: Tue Feb 03, 2009 10:27 am

Windows10 and Samba File Sharing

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

Windows 10 and Samba File Sharing
Note: This Howto has 3 parts.

[Part 1] Connecting to a Linux Samba Server from Win10

Samba is used to connect Linux to Windows and has traditionally used NetBIOS to discover hosts by name ( netbios name ) but Win10 made some changes that affect how this works. On the client side ( accessing Linux from Win10 ):
Windows 10 Home and Windows 10 Professional still contain the SMBv1 client by default after a clean installation. If the SMBv1 client is not used for 15 days in total (excluding the computer being turned off), it automatically uninstalls itself.
SMBv1 and browsing for netbios hosts in Explorer are linked. You can't have one without the other so it will never see your Linux samba server in Explorer.

You can still access the Linux machine by name or ip address but it has to be done explicitly in Explorer:
By name: \\mint-host-name
By ip address \\mint-ip-address

Another change Win10 made is that it can now use mDNS which Linux and MacOS use:

[Part 1a] 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

\\mint-host-name.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

[Part 1b] WSD = WS-Discovery

There is another option. Windows replaced NetBIOS years ago with WSD. There is no implementation of WSD in Samba yet but there is a way to implement it in Linux thanks to someone over at github: https://github.com/christgau/wsdd

You can use that to enable WSD on your box so that Win10 can discover it without the use of NetBIOS or SMBv1:

Download the folder:

Code: Select all

wget https://github.com/christgau/wsdd/archive/master.zip
UnZip it:

Code: Select all

unzip master.zip
Rename the python script:

Code: Select all

sudo mv wsdd-master/src/wsdd.py wsdd-master/src/wsdd
Copy it to bin:

Code: Select all

sudo cp wsdd-master/src/wsdd /usr/bin
Copy the systemd service file to /etc/systemd/system:

Code: Select all

sudo cp wsdd-master/etc/systemd/wsdd.service /etc/systemd/system
Edit the wsdd.service file to remove references to the nobody user:

Code: Select all

sudo nano /etc/systemd/system/wsdd.service
#User=nobody
#Group=nobody
Reload the service:

Code: Select all

sudo systemctl daemon-reload
Start the service:

Code: Select all

sudo systemctl start wsdd
Enable the service so it starts at boot:

Code: Select all

sudo systemctl enable wsdd
That is pretty much it. Win10 will see your Linux machine automatically using WSD.
Last edited by altair4 on Fri Aug 09, 2019 2:49 pm, edited 14 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 19
Level 19
Posts: 9633
Joined: Tue Feb 03, 2009 10:27 am

Re: Windows10 and Samba File Sharing

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

[Part 2] Connecting to a Win10 box from Linux

Microsoft made another change to SMBv1 on the server side:
Windows 10 Home and Windows 10 Professional no longer contain the SMBv1 server by default after a clean installation.
In the past Ubuntu could only access the network using SMB1 so it made a change that created this bug:
https://bugs.launchpad.net/ubuntu/+sour ... mments=all
That bug was fixed but it created another bug:
https://bugs.launchpad.net/gvfs/+bug/1828107

All of this results in you being able to discover the Win10 box but unable to access it.

But just like in Windows you can still access it's shares without adjusting the client max protocol but have to do so explicitly in nemo:

By name: smb://win10-host-name
By ip address: smb://win10-ip-address
Note: Nemo needs to be closed and reopened before using the above.

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

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 Sun Aug 18, 2019 7:59 am, edited 11 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 19
Level 19
Posts: 9633
Joined: Tue Feb 03, 2009 10:27 am

Re: Windows10 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 Jan 23, 2019 3:35 pm, edited 2 times 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 19
Level 19
Posts: 9633
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”