getumbrel / umbrel-apps

The official app repository of the Umbrel App Store. Submit apps and updates here. Learn how → https://github.com/getumbrel/umbrel-apps#readme
https://apps.umbrel.com
536 stars 395 forks source link

Samba not connecting to any client #1325

Open mathix420 opened 3 months ago

mathix420 commented 3 months ago

Tested on windows and iOS, with tailscale and without (local-ip & umbrel.local)

arguser commented 3 months ago

Oh, here you are!

Hey @mathix420 on Windows you won't get it working because the Samba Umbrel App doesn't run on the default Samba port, which is taken by Backup My Mac. I made it work on MacOS and Linux by being explicit on which port I want to connect to. I think they should switch the ports between those apps.

mathix420 commented 3 months ago

Aha yes, sorry for the duplicate, wasn't sure where to post this. I knew this already, and do specified the ports but still doesn't work, is there any way to debug this? I'm a developer I should be able to troubleshoot this, but can you give me a hint on what to check.

arguser commented 3 months ago

On Mac I didn't do anything special just followed the configuration steps, on Windows there are other file explorers you can use such as OwlFiles https://www.microsoft.com/store/productId/9MSQ3SZK42KP?ocid=pdpshare I didn't had any luck with https://learn.microsoft.com/en-us/windows-server/storage/file-server/smb-ports?tabs=powershell either. Also I would check if there's a firewall or anything on your network blocking traffic on such ports/computers.

mathix420 commented 3 months ago

I managed to get my way through this, here is what I learned/worked for me:

  1. Almost all my issues were because of the fact samba wasn't available at port 445 (as @arguser told me in another comment)
    • Connection strings shown in the documentation page hosted by umbrel are wrong. They won't work with almost all native clients. Because ports (:446) are not supported by most implementations of the samba protocol (tested on Explorer Windows 11 and Files iOS 17).
    • My solution, as I am not using Backup My Mac, was to forward the port 446 to the port 445 using tailscale by running this command inside the tailscale container.
      tailscale serve tcp:445 tcp://localhost:446
  2. After successfully connecting to samba server, permission issues occurred
    • Default directory being hosted by samba is /storage, it turns out the owner of /storage on my end was root but should be umbrel to work as expected. Simple solution:
      sudo chown umbrel $YOUR_DIRECTORY

This is probably too complicated for casual users, which seems to be the target audience of Umbrel. A good solution to that (apart from fixing the permission issue) would be to create a list allowed ports in the umbrel-app.yml that will choose the first one that is free. This way if users are not using both BackupMyMac & Samba they will have no issues at all. The umbrel config will then pass the chosen port through an environment variable that can be used in the docker compose file.

umbrel-app.yml

ports:
  samba: [445, 446, 447, 411, 412]
  ui: [9445, 9446]

docker-compose.yml

ports:
  - "${SAMBA_PORT:-445}:445"
# ...
ports:
  - "${UI_PORT:-9445}:9445"

Not sure about this implementation, but hopefully it will lead to a better idea. In any case it would be great to see the documentation of the Samba UI/docs updated to let the user know that it does not work out of the box.

kriakiku commented 2 months ago

In Windows 11 Insider Preview Build 25992, support for changing the SMB port was added, now we just have to wait for it to appear in stable updates :) https://learn.microsoft.com/en-us/windows-server/storage/file-server/smb-ports?tabs=powershell

There is also a workaround for connecting, but it's too complicated: https://superuser.com/questions/702948/how-to-mount-a-samba-share-on-non-standard-port