SMB file sharing issue

Æsoteric Positron

I AM GROOT (and so are you)
So here's a weird problem:
I wanted to share my files from my pc(Linux) to my lappy(windows), but my PC didn't had a wifi card, so I used USB tethering on my PC.

I configured to share a windows folder through SMB and configured the Linux one through dolphin(Samba) My Linux PC got my windows folder, when I put up the IP address and put in the username and password, but my windows lappy for the life of it couldn't get the Linux folder, then I connected my phone(which was doing the tethering to Linux PC) to the Linux machine's SMB (through solid file explorer)it picked up my linux's folder. Then at last I pinged my Linux machine using windows, and my windows machine couldn't pick it up!!

At last I gave up, my guess is, the Linux machine wasn't connected to the router directly, so my windows PC couldn't ping it, but really that doesn't explain why Linux machine was able to pick up my windows SMB, maybe a one way network ?

Now, I ain't a networking expert by any means, so if someone here knows about it more, can you tell me tf was wrong here? Shead some optic fibre light :)
 

whitestar_999

Super Moderator
Staff member
It involves linux so complicates the matter. What version of smb are you using on win 10 laptop? Try with smbv1(not secure so not recommended & nowadays is disabled by default on win 10) to see if it works.

@Desmond David
 

Desmond

Destroy Erase Improve
Staff member
Admin
I will have to try this out and see practically. I haven't really shared anything between two different OSs in a long while.
 

Desmond

Destroy Erase Improve
Staff member
Admin
Can you describe what setup you have done for this? Both on Windows and Linux side.
 
OP
Æsoteric Positron

Æsoteric Positron

I AM GROOT (and so are you)
@whitestar_999
Code:
EnableSMB1Protocol              : True
EnableSMB2Protocol              : True
No idea how to switch my SMB protocol on either of my OS though. But I think it would matter which one of these is selected on my linux PC more.
Can you describe what setup you have done for this? Both on Windows and Linux side.

Yeah! On my windows laptop I have turn on network sharing and shared a folder to everyone (not guests) using properties panel. It shows on every system. I have also turned on SMB1 file sharing just to be sure, from the extra features in control panel.

On my linux machine I have shared my folder using the method instructed here Using Samba in your File Manager - Manjaro, using dolphin as my file explorer.

Now here's what I did differently, I turned on USB tethering through phone on my linux PC as it does not have a wifi card ( or any other method to access the internet).

My windows laptop couldn't catch the share of my linux laptop(tried mapping the drive through networking, using the wizard and filling the folder structure as thus \\ipaddress or the name of my PC\ and entering my credentials), but my phone (that was connected through USB tethering) could. Whats even more that my linux machine could in fact catch the share of my windows PC.

At last I tried pinging the ip of my linux PC but my windows laptop couldn't ping it, and that is the reason why I suspect the USB tethering is to blame here, more than my linux samba configuration.

Hope that gives u a better idea.
 

whitestar_999

Super Moderator
Staff member
Looks like usb tethering may indeed be the reason for this. If you can borrow some usb wifi adapter for testing then that would confirm this. Also buy a wifi usb adapter with linux compatibility anyway as they are not that costly.
 

Desmond

Destroy Erase Improve
Staff member
Admin
Can you also check whether you have cifs-utils installed? AFAIK, it is required for accessing folders shared from Windows. Also, most of the modern file managers in Linux can display folders shared on networks (ex. In Dolphin, click on Network in the left panel)
 
OP
Æsoteric Positron

Æsoteric Positron

I AM GROOT (and so are you)
Looks like usb tethering may indeed be the reason for this. If you can borrow some usb wifi adapter for testing then that would confirm this. Also buy a wifi usb adapter with linux compatibility anyway as they are not that costly.
Yeah, I am planning to buy one( or a wifi card) soon, I don't know anyone who might have it, or the ones I know, can't be met, not in current situation anyway.

Can you also check whether you have cifs-utils installed? AFAIK, it is required for accessing folders shared from Windows. Also, most of the modern file managers in Linux can display folders shared on networks (ex. In Dolphin, click on Network in the left panel)
Linux displays the folder perfectly, its windows which actually struggles here.
 

Extreme Gamer

僕はガンダム!
Vendor
Can you check what authentication protocol your samba setup is using? IIRC windows 10 requires NTLMv2 or higher.

Also check your Linux firewall rules, because the USB tether will be treated as a different network interface to your usual network connection. On most systems, especially firewalld it means it may belong to a different zone.

Can you also run some packet testing on the USB tethering interface? Like start watching that interface and filter to the SMB port and your windows IP address, then try to connect to it with your windows SMB client. See if packets are hitting the tether.
 
OP
Æsoteric Positron

Æsoteric Positron

I AM GROOT (and so are you)
Can you check what authentication protocol your samba setup is using? IIRC windows 10 requires NTLMv2 or higher.
No idea, how to check?
Also check your Linux firewall rules, because the USB tether will be treated as a different network interface to your usual network connection. On most systems, especially firewalld it means it may belong to a different zone.
I don't think I even had firewall enabled till yesterday on my linux machine.
Can you also run some packet testing on the USB tethering interface? Like start watching that interface and filter to the SMB port and your windows IP address, then try to connect to it with your windows SMB client. See if packets are hitting the tether.
I tried to ping my linux machine, and windows couldn't ping it. What would be the other method be?
What distro are you using BTW?
Manjaro :)

Would this be ok btw https://www.amazon.in/gp/product/B008IFXQFU/

PS.I am buying just for SMB so if someone have used this in the home connection please inform if your router can see its IP.
 

Extreme Gamer

僕はガンダム!
Vendor
No idea, how to check?
On OpenSUSE t is in /etc/samba/smb.conf, but it should be in the same place on Manjaro as well. You can read the manpage for smb.conf to figure out the settings.
I don't think I even had firewall enabled till yesterday on my linux machine.
That's odd. You definitely must have some kind of iptables or nftables rules enabled by default. Without any rules the firewall should generally block all new incoming connections to your device. I don't know which firewall Manjaro uses by default, so you will have to look at Manjaro's documentation. Firewalld is simply a management overlay of sorts for that. Since you mention "till yesterday", I am assuming you just installed firewalld. Look at setting it up, and change the zone for your USB hotspot interface, to "home" and in the permanent settings for the home zone, make sure the icmp and icmpv6 services are permitted. Alternatively you can enable the ports for those services.
I tried to ping my linux machine, and windows couldn't ping it. What would be the other method be?
Is sshd enabled on your PC? Can you SSH to it? Did you have any other machines that you were able to use to ping to it?

Please help me understand your network topology exactly. From what I read it appears to be as follows:

linux PC<->mobile phone USB tether<->wifi<->router<->laptop.

Would this be ok btw https://www.amazon.in/gp/product/B008IFXQFU/

PS.I am buying just for SMB so if someone have used this in the home connection please inform if your router can see its IP.
According to the Amazon listing, the device works up to kernel 4.4.3. Make sure you look at the docs. Considering Manjaro is basically Arch Linux with some tweaks, you should be on 5.9.x by now. I don't know what chip that particular dongle is using, so that's something you'll have to look up. Usually generic open source drivers work, but some chips can be a royal PITA to handle - my Z87I deluxe has built-in wifi and bluetooth which I have been unable to make work on linux in the past five years.

If you have a wireless router at home, why not just plug a CAT6 cable to the PC and call it a day?
 

Desmond

Destroy Erase Improve
Staff member
Admin
Just buy it and then test it. If it doesn't work, then return it. I had to return one such dongle once.
 
OP
Æsoteric Positron

Æsoteric Positron

I AM GROOT (and so are you)
On OpenSUSE t is in /etc/samba/smb.conf, but it should be in the same place on Manjaro as well. You can read the manpage for smb.conf to figure out the settings.
Code:
[global]

   workgroup = WORKGROUP

   dns proxy = no

   log file = /var/log/samba/%m.log

   max log size = 1000

   client min protocol = SMB2

   server role = standalone server

   passdb backend = tdbsam

   obey pam restrictions = yes

   unix password sync = yes

   passwd program = /usr/bin/passwd %u

   passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*

   pam password change = yes

   map to guest = Bad Password

   usershare allow guests = yes

   name resolve order = lmhosts bcast host wins

   security = user

   guest account = nobody

   usershare path = /var/lib/samba/usershare

   usershare max shares = 100

   usershare owner only = yes

   force create mode = 0070

   force directory mode = 0070

   netbios name = XXXX

That's odd. You definitely must have some kind of iptables or nftables rules enabled by default. Without any rules the firewall should generally block all new incoming connections to your device. I don't know which firewall Manjaro uses by default, so you will have to look at Manjaro's documentation. Firewalld is simply a management overlay of sorts for that. Since you mention "till yesterday", I am assuming you just installed firewalld. Look at setting it up, and change the zone for your USB hotspot interface, to "home" and in the permanent settings for the home zone, make sure the icmp and icmpv6 services are permitted. Alternatively you can enable the ports for those services.
I installed UFW that day, iptables was installed but not enabled in systemctl. I even tried allowing all connections so that can't be a problem ig.
Code:
sudo ufw status verbose



Status: active
Logging: on (low)
Default: allow (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
137,138/udp                ALLOW IN    Anywhere                
139,445/tcp                ALLOW IN    Anywhere                
137,138/udp (v6)           ALLOW IN    Anywhere (v6)            
139,445/tcp (v6)           ALLOW IN    Anywhere (v6)
Is sshd enabled on your PC? Can you SSH to it? Did you have any other machines that you were able to use to ping to it?
1 nope 2. ofc nope 3. I only have 2 machines, but my other phone(not in tethering) also can't get the file share.
Please help me understand your network topology exactly. From what I read it appears to be as follows:

linux PC<->mobile phone USB tether<->wifi<->router<->laptop.
Exactly correct, router is connected to laptop through wifi too

According to the Amazon listing, the device works up to kernel 4.4.3. Make sure you look at the docs. Considering Manjaro is basically Arch Linux with some tweaks, you should be on 5.9.x by now. I don't know what chip that particular dongle is using, so that's something you'll have to look up. Usually generic open source drivers work, but some chips can be a royal PITA to handle - my Z87I deluxe has built-in wifi and bluetooth which I have been unable to make work on linux in the past five years.
Oops I misunderstood it as working from 4.4.3 onwards.
If you have a wireless router at home, why not just plug a CAT6 cable to the PC and call it a day?
Eh, cable clutter thus family not agreeing.
Just buy it and then test it. If it doesn't work, then return it. I had to return one such dongle once.
Yeah, I got it for 380, but it would be a shame if it wouldn't work, hope amazon return service is good lol.

What adapter/wifi card do you guys use in linux?
 
Last edited:

whitestar_999

Super Moderator
Staff member
Can you put a sharing password on linux shared folder & then try from windows? Basically set it up so that accessing shared linux folder needs username/password prompt.
 

Extreme Gamer

僕はガンダム!
Vendor
Well if you can't ping your server, then I'd look into being able to access it remotely with SSH. For testing purposes, enable ssh and try to access it from your laptop with PuTTY or something.

Also see if your linux PC is detected by your router. If your phone is NAT-ing it then it might not have a separate address from your phone. That would definitely put a spanner in the works. In fact, since you say PC->laptop works but laptop->PC doesn't, try to hit your laptop with packets from both your phone and your PC. With netstat and some appropriate filters you should be able to see how your laptop identifies the packets from your phone and your PC.
 
Top Bottom