23

I'm looking for a way for my HTC Hero (Android 2.1) so I can share the contents of my SD card and phone memory over the WiFi network like a regular Windows file share. I'd like one that does not require me to root my phone, and am willing to pay for the right app so it doesn't have to be free.

I'm thinking of using SMB server and all I've found so far are:

  1. SambaAndroid which requires root access.
  2. androidsmb which is a "Java implementation of the SMB/CIFS network file and printer share server for Android devices" hosted on Google Code that has no documentation and has not released any files.

Is it even technically possible to develop an SMB Server on Android that can be installed without root access?

1

6 Answers 6

14

As your original question still isn't answered and I wondered the same, here's the answer.

Short answer: No, without root it's not possible to run an SMB server using the default ports so that it's found by Windows PCs.

Long answer: SMB either runs on ports 137-139 (UDP and TCP) using NetBIOS or on newer systems (from Windows Vista onwards) directly on TCP port 445 where in the latter case computer names are resolved by the LLMNR (Link-local Multicast Name Resolution) protocol which runs on UDP port 5355. Why is this important? Apps not running as root can't bind to unprivileged ports (<1024). It's possible to use alternative ports for SMB but Windows is hard-wired to just listen to the default ones. So I guess if you use Linux or a separate SMB client for Windows which allows to connect to a server with a custom port number it's probably possible. But it's not really a straight-forward way.

1
  • 1
    I wonder if Windows can cope with \\your.ip:port... Commented Jan 15, 2015 at 18:33
10

While it may not be possible to run an SMB server without root or using port forwarding, it is possible to run a WebDAV server without root for a similar effect.

Setting up an Android WebDAV server

On my stock Nexus 7, I installed WebDAV Server, opened it, clicked on the start button and was immediately able to see my /storage/sdcard folder in my web browser at the URL displayed by the application, i.e. http://192.168.x.y:8080

Note that with WebDAV, you also have the option of selecting Root (/) or DCIM as well as SdCard as the WebDAV root.

Using the WebDAV server through Windows Explorer

I then mapped http://192.168.x.y:8080 as a network drive in Windows Explorer and could the access the contents of my storage drive, just as if I was connected via MTP, but through a drive letter.

Sadly, this solution is incredibly slow.

Every directory change takes between 6 and 20 seconds, as does accessing most files. Once a file is accessed though, it transfers at a reasonable speed (copying a single 42MB file in Windows Explorer took around 60 seconds, so 700KB/s).

Thus WebDAV via Windows Explorer is Ok for downloading a few large files whose location you know, but browsing or syncing a whole device this way isn't quick. I synced 1.75GB of data in around 6000 files and 400 directories and it took 10 hours, i.e. around 50KB/s or 10 files/dirs per minute on average.

Using the WebDAV server through Windows command line

Even from the command line, each directory listing takes 5-6 seconds, as does any file access. Copying the same 42MB file from the command line took around 20 seconds, so around 2.1MB/s.

Using the WebDAV server through a web browser

The fastest option for WebDAV is to use your web browser though, directly through the URL given. Changing directory rarely takes more than a second and downloading the same 42MB file from the web browser took around 12 seconds, so around 3.6MB/s.

The downside of using the web browser is that it only shows the date (no size or type) and makes no distinction between files and directories so if a file doesn't have an extension (or a directory does) then it may not be obvious if clicking on a link will take you to another web page (for a directory) or start a download (for a file).

Caveats

  • By default, Windows limits the size of WebDAV downloads to 50000000 bytes (47.6MB), though this can be changed through a registry hack (FileSizeLimitInBytes in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters) if you know what you are doing.

  • WebDAV access is not secure. Even if you set a password on the WebDAV share, the connection is still http not https, so it is not encrypted. Only use WebDAV on a secure wifi network and certainly don't enable the WebDAV server while you are in an internet cafe or other unsecured wifi.

1
  • Tested on Samsung S10 + Windows 8.0. Works fine.
    – Brethlosze
    Commented Jun 20, 2019 at 16:07
5

The issue is not the samba server, but the fact that Windows can access a samba share only on port 445, and on a non-rooted android a normal App can't listen on port 445.

But you can overcome this with some TCP port-mapping:

  1. Install a samba server on your android, and make it listen on a port like 7777
  2. Install a TCP port-forwarding software somewhere (I installed it on a virtualPC)
  3. Setup the portmapping software to listen for connections on port 445, and forward the connections to your android on port 7777
  4. Now you can access the shared folder on this virtualPC, and you'll get the data from the samba server installed on android (trough the portmapping)

I've described all the steps in detail here on my blog http://techforpassion.blogspot.it/2013/12/android-how-to-share-folder-over-wifi.html

I've tried different samba server, and the only free app that works in this configuration is called Samba Server

2
  • Interesting proposal, but can't you enter something like \\androids.ip:7777 in the explorer address bar? Commented Jan 15, 2015 at 18:34
  • 1
    @tobias kienzler To my knowledge, this won't work
    – Max
    Commented Jan 15, 2015 at 19:52
3

I currently finished an app (for non-rooted devices) for sharing files in local network. My lessons learned:

  • It is possible to run an SMB Server on Android without root access (on non-privileged port). Mac OS X connects to it without any problems (if you broadcast your ip and port via Bonjour). But Windows dont. As already said by another users, Windows uses "hardcoded" privileged ports for SMB access. The only way I found for connecting with Windows is creating an loopback network adapter as explained here (not the same purpose, but the idea). Finally I think, that the user-friendliest way is using WebDAV on Windows. Even if the Windows do it not user-friendly, because you have to enter your ip by hand and I did not find a way how it could be discovered (please drop me a line, if you know one).
  • In the Mac OS X world the SMB protocol is a clear winner. Your share will be auto-discovered by Bonjour and magically appears in Finder. It is weird, that WebDAV and FTP shares are ignored (not auto-mounted by Finder), though they are supported by Bonjour. Third-party clients (e.g. Cyberduck) have no problems with auto-discovery of these shares.
2

Alternatively, you could run a ftp server on your phone to get access to your SD card's content. Check out SwiFTP.

1
  • I second SwiFTP. You won't be able to take any files off the phone using it without being root, but it should work fine for the SD card.
    – Webs
    Commented Sep 29, 2010 at 12:57
1

I may be misunderstanding but it sounds like you need an SMB client, not a server. Also, you do not need root access. To use SMB to tranfer files to you computer you can use ASTRO File Manager with the SMB addon, or there's File Expert which is also free.

You could also use WebDAV instead of SMB with an app like WebSharing.

In the past I used an app that with client software on my computer allowed me to transfer files through the file explorer from anywhere through the web. It wasn't a full VNC app. I got a new phone and now for the life of me I can't find the app.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .