How to get my ubuntu shared folders appearing under network in windows 10

10,741

Solution 1

[1] It sounds like you already are using Samba. Please verify by running this command:

net usershare info --long

[2] Ubuntu 18.04 automatically "registers" your samba server to the rest of the network using mDNS ( Avahi ). All other Linux machines as well as macOS can "discover" this registration automatically.

[3] The reason Win10 cannot discover your server is becase although it can use mDNS it does not know how to scan the network for them automatically. Instead it uses NETBIOS and there are multiple problems with that:

[a] Win10 disables SMB1 on the client side ( as well as the server side ) and NETBIOS ( host name discovery not name resolution ) and SMB1 are linked - can't have one without the other. You can re-enable it by going to Control Panel > Programs and Features > Turn Windows features on or off > SMB 1.0/CIFS File Sharing Support > SMB 1.0/CIFS Client.

[b] But then you have to follow the NETBIOS rules - namely that your host name cannot be greater than 15 characters in length - among other things. Those kinds of things can be corrected in smb.conf. What you could do is edit /etc/samba/smb.conf and add these two line right below the workgroup = WORKGROUP line:

netbios name = ubserv1804
name resolve order = bcast host lmhosts wins

Then restart samba in this order:

sudo service smbd restart
sudo service nmbd restart

Then wait about 10 minutes or so - seriously. NETBIOS is so primitive that a restart of nmbd causes confusion in Windows and it takes a bit for it to act normal again.

Solution 2

I have an alternative with respect to Windows 10 if anyone is interested. I submitted this as a bug / feature request in launchpad: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1831441

There exists in github something that has most of this already created. One can use it in Ubuntu but it requires some work to implement:

[1] Download the file:

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

[2] UnZip it:

unzip master.zip

[3] Rename the python script

sudo mv wsdd-master/src/wsdd.py wsdd-master/src/wsdd

[4] Copy it to /usr/bin

sudo cp wsdd-master/src/wsdd /usr/bin

[5] A systemd service file is already provided in the package it just needs to be copied to the correct location:

sudo cp wsdd-master/etc/systemd/wsdd.service /etc/systemd/system

[6] The wsdd.service file has to be edited to remove references to the nobody user:

#User=nobody
#Group=nobody

[7] Then enable the service:

sudo systemctl daemon-reload
sudo systemctl start wsdd
sudo systemctl enable wsdd

Now Win10 can discover the Ubuntu server with its own native WSD protocol and there is no need to enable smb1 on the client side.

Share:
10,741

Related videos on Youtube

benikens
Author by

benikens

Updated on September 18, 2022

Comments

  • benikens
    benikens over 1 year

    My home network is as follows:

    1. File Server -> Ubuntu 18.04
    2. Workstation/Gaming Rig -> Windows 10
    3. Dev laptop -> Ubuntu 18.04

    I want to make my shared files work easily with both my machines and also for anyone else who jumps on the network like housemates etc.

    The file server has a 2x 120gb SSDs in raid 1 for boot, 2x 2tb HDDs in raid 1 for my dev files called Dev and a spare 2tb drive shared for network accessible media in my house called Media.

    I've shared the folders by opening each one up and going into properties and enabling sharing, granting all permissions and checking both the guest access and allow others to create and delete files in this folder. I do plan to change permissions on the dev drives later but I just need it to work first.

    From my laptop I can go Files -> Other Locations and see the server there, I can click on a Share and access my files.

    On Windows if I open Explorer and click Network I cannot see the server. I really want it to appear here because I don't want to have to map drives manually I want the files easily accessible.

    How do I make the network drives visibile under network in Windows 10? Do I need to use Samba or is the method of sharing I'm doing fine?

  • benikens
    benikens over 5 years
    server@server:/var/lib/samba/usershares$ net usershare info --long [Dev] path=/media/server/Dev comment= usershare_acl=Everyone:F, guest_ok=y [Media] path=/media/server/Media1 comment= usershare_acl=Everyone:F, guest_ok=y
  • benikens
    benikens over 5 years
    Can't figure out how to format that so it's readable, it doesn't say anything about samba? Maybe I'll try a samba guide. I checked the windows thing and SMB1.0 client is already enabled
  • Morbius1
    Morbius1 over 5 years
    You have 2 samba shares: [Dev] and [Media]. The fact that they are being accessed as samba shares from your other Linux machine affirms that they are samba shares. If the Win10 client still has the smb1 client enabled then this is a netbios name resolution problem as I discussed above.
  • Morbius1
    Morbius1 over 5 years
    Side Note: The path to your shared folders is under /media/server which is your user name. You won't be able to access those shares as guest or anonymous unless you add something else to your smb.conf file. So under the "name resolve order = bcast host lmhosts wins" line I suggested you add I would add another one - without quotes: "force user = server"
  • benikens
    benikens over 5 years
    Ok so I went and added your edits to smb.conf then restarted the service. I can see it called UBSERV1804 on the network from Ubuntu on my laptop. I still can't see it on Windows 10 though
  • Flimm
    Flimm about 3 years
    This seems to be the same as this article: devanswers.co/… Are you the same author?
  • Morbius1
    Morbius1 about 3 years
    Nope. I actually got the original idea from the Ubuntu forums but had to experiment and modify the steps a bit it before it worked.