[APP] Samba Server for Android

Search This thread

_LexX_

Member
Dec 5, 2005
16
0
Hello all
I'm using HTC Desire with LeeDroid 2.0 firmware. On my device i got a problem with Samba autostart/autostop script (dhcpcd hook).

After WiFi has a connection /data/local/log looks good - it has records ${reason}: new_broadcast_address, but no smbd/nmbd processes started.

I tried to modify samba-rc script to add logging redirect to smbd launch:
$PRE/bin/nmbd -D $NDEBUG >> /data/local/log

but has no effect

Need help :(
 

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
Yes, it requires root permissions, at least for now.

I never tried the dhcpcd hook. What scripts exactly does it create?
 

_LexX_

Member
Dec 5, 2005
16
0
Yes, it requires root permissions, at least for now.

I never tried the dhcpcd hook. What scripts exactly does it create?

Here is the script:

SUSH=/system/bin/dhcprootshell
SAMBARC=/data/local/samba/bin/samba-rc

case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)
#set >> /data/local/log
$SUSH -c "$SAMBARC restart" # >> /data/local/log 2>&1
;;

EXPIRE|FAIL|IPV4LL|STOP|RELEASE)
$SUSH -c "$SAMBARC stop" # >> /data/local/log 2>&1
;;
esac
 

mustafazr

Senior Member
Apr 23, 2008
67
4
Bay Area, CA
Worked like a charm for me. I would be very interested in packaging a UI/.apk for this and maybe even posting it on the Market. I have some Android dev experience so let me know if I can be of any help.

I think this is ridiculously useful as this is the only way I can truly do WiFi syncing of Music (I'm using MediaMonkey - I believe you could use Winamp too).
 
D

dangsquall

Guest
That's exactly what I'm trying to do as well, although I try to use SyncToy in order to sync the music folder. The permission bug prevents me to do that as SyncToy has problems with Read-only files. Have you tried MediaMonkey to sync yet? I might try that option tomorrow how that goes :D
 

JimmyChingala

Senior Member
Apr 14, 2010
199
228
Melbourne
Access the external storage card in your Android device over wifi as a shared folder

Hi, thanks for your interest in this app!

If you use it, please do post feedback about success, failure, suggestions for improvement etc. Be sure to include the app version you have installed (Menu -> Settings -> About), your Android device make, model & ROM version, and support log file if you are having problems (Menu -> Settings -> Create Support Log - send via PM or e-mail, please dont post the log to the forums).

Am also interested to hear about copy xfer rates to/from your device. My HTC Hero gets between 700 KB/s to 1MB/s, my Asus Transformer about 2.5MB/s.

This app requires your device to already have:
- root access.
- Superuser 2.3.6.2 or later, from Android Market (may work with other Android 'su' implementations but I havent tested with any others).


Installation
* The two most recent development builds are attached below.
* Or you can Install the current Android Market version:


On the first run, make sure you catch the SuperUser Auth request to allow the Samba Filesharing app root access.

Also, the first run will be a bit slow, the app has to unpack some additional binaries into its private data space.

GPL: Samba GPL licensing information including source code modification details are included in the app. Once installed go to Menu -> Settings -> About.

- jc

Screen shots (click to enlarge):

110905main_full.png 110905prefs_01_full.png 110905prefs_02_full.png 110905prefs_03_full.png

Change history


If you like this app, please consider making a small donation. Not to me, but to one of the charities I strongly support: Cancer Research, or Animal Welfare.

Dev builds attached below - To install: unzip, and either:
- ADB: adb install SambaFilesharing<version>.apk
- FileManager: Copy the APK to /sdcard on your device, then launch with a filemanager program (like Astro).
(Dev build change history)



To-Do list (in no particular order)
- finish notification bar icon re-code
- Add support for NTFS formatted sdcards.
- Improve support for devices (eg Tablets) with multiple 'sdcard' type storage devices.
- multiple/more configurable shared folders, multiple user accounts.
- add in a CIFS mount manager
- Improve available characters and lengths of username, password, workgroup, netbios-name fields.
- toggle widget
- Add option for persistent display of app 'Menu' button items.
- move this page to the Android Apps and Games forum.

(The below SambaFilesharing-dev-130413.zip is the the Google Play 140525 version with extra dev options turned on )
 

Attachments

  • SambaFilesharing-dev-130413.zip
    1.8 MB · Views: 16,836
Last edited:
Apr 8, 2010
13
0
Jimmy, works great except that I still can't upload files to the sdcard using Nautilus in Ubuntu 10.04, I get the error "Invalid argument" and then it shows up on the sdcard as a 0 byte file which I can delete.
Downloading works great though.
For the record I am running cyanogen 6 stable.
 

JimmyChingala

Senior Member
Apr 14, 2010
199
228
Melbourne
Jimmy, works great except that I still can't upload files to the sdcard using Nautilus in Ubuntu 10.04, I get the error "Invalid argument" and then it shows up on the sdcard as a 0 byte file which I can delete.
Downloading works great though.
For the record I am running cyanogen 6 stable.

Hey, on my Ubuntu 9.10 VM + Nautilus 2.28.1 I get the same thing.

But on another VM i have running Ubuntu 9.04 + Nautilus 2.26.2 read/write to the /sdcard share works ok.

Perhaps its a Ubuntu or Nautilus issue, I will see what else i can find.

Update - Solved
See this post.

- jc
 
Last edited:

hawkeyexp

Senior Member
May 26, 2006
220
40
Hi,

fantastic Job ! The APK-Version works perfect for me.

But i have one improvement proposal for the next version:

can you add the option to add an other username instead of root ?

A nice feature as addon could be changing the name of the sdcard-share and adding other shares :)

greats Hawkeye
 
Last edited:

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
Worth noting a couple of things:

1) Username for connection is "sdcard" (without quotes). Took me a bit of time to figure it out (most of the time was spent to find the app directory :)).

2) Read-only bug still persists on all systems - my workaround for 7/Vista isn't implemented yet, and permissions aren't translated in the code yet (the way Android mounts SD card isn't compatible with Linux standard permissions, and it confuses Samba - the code wasn't modified yet to overcome it). Moreover, since the app overwrites smb.conf on each change, including enable/disable, there is no way to implement my workaround.

3) Wake locks aren't implemented yet (severe slowdown when phone goes to sleep).

4) Bug in UI - the Samba server status (topmost line) isn't updated until the screen is touched.

5) Suggestion - instead of buttons "Enable"/"Disable", make a single button that toggles its state (and name).

Otherwise, good job creating the APK. Thanks.
 
Last edited:

JimmyChingala

Senior Member
Apr 14, 2010
199
228
Melbourne
Hi,

fantastic Job ! The APK-Version works perfect for me.

But i have one improvement proposal for the next version:

can you add the option to add an other username instead of root ?

A nice feature as addon could be changing the name of the sdcard-share and adding other shares :)

Hi Hawkeye, I dont think i can change the requirement to run as root, but the other customisations are doable - "adding other shares": what did you have in mind?

- jc
 

FadeFx

Senior Member
Mar 22, 2010
8,838
3,034
Vienna
Hi Hawkeye, I dont think i can change the requirement to run as root, but the other customisations are doable - "adding other shares": what did you have in mind?

- jc

jimmy i think he wanted to suggest to set specific folders as shares, so not the whole sdcard would be accessable.

setting a username, password and workgroup name after installation would be extra cool, this way one could set his windows username/pw and everything is working.
 

JimmyChingala

Senior Member
Apr 14, 2010
199
228
Melbourne
Hey Jack,

Worth noting a couple of things:

1) Username for connection is "sdcard" (without quotes). Took me a bit of time to figure it out (most of the time was spent to find the app directory:)).

Yeah i'll include it on the main layout along with IP, status etc.

2) Read-only bug still persists on all systems - my workaround for 7/Vista isn't implemented yet, and permissions aren't translated in the code yet (the way Android mounts SD card isn't compatible with Linux standard permissions, and it confuses Samba - the code wasn't modified yet to overcome it). Moreover, since the app overwrites smb.conf on each change, including enable/disable, there is no way to implement my workaround.

Is there a reliable way to reproduce the problem? What is your w/a?

3) Wake locks aren't implemented yet (severe slowdown when phone goes to sleep).

I havent had a chance to test yet, but Power manager Wakelock or wifimanager wifi lock: - any idea whether one would be better than the other?

4) Bug in UI - the Samba server status (topmost line) isn't updated until the screen is touched.

5) Suggestion - instead of buttons "Enable"/"Disable", make a single button that toggles its state (and name).

Otherwise, good job creating the APK. Thanks.

Added them to my 'list' - thanks!

- jc
 

FadeFx

Senior Member
Mar 22, 2010
8,838
3,034
Vienna
Hey Jack,

I havent had a chance to test yet, but Power manager Wakelock or wifimanager wifi lock: - any idea whether one would be better than the other?

- jc

i´d suggest to have an option to configure this in the ui, also there should be a status bar icon [smb] with different colors for different wakelock status.

like

stage 1 (yellow [smb]) power manager wakelock (which i think causes the slowdown)
stage 2 (red [smb]) power manaker + Wifi manager lock.

also powermanager wakelock should only be active as long as wifi is on.
 

mik101

Senior Member
Jul 13, 2010
765
194
Hey Jimmy, I was working on a list for you too, but Jack hit the nail right on the head -- the first thing I went to do was implement his workaround for permissions.

Overall really nothing new to report. All bugs I've come across have been previously mentioned in Jack's last post (thanks!), oh and the screen not updating until its clicked after settings are changed.

The community thanks you!
 

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
Is there a reliable way to reproduce the problem? What is your w/a?
- jc

The problem is reproduced very easily and 100% reliably. When you open the shared folder from any OS, you see that all the shared files have "read-only" permissions. "Delete readonly = yes" helps in deleting them (with additional prompt that's a bit annoying, but it's small stuff), but many applications don't work this way - for example, if you open the files in editor, it won't let you save them because of read-only permissions set. So you practically can't work with those files directly.

It happens because of the way permissions are translated from FAT32 on Android vs on Linux. The permissions of the mounted SD card on Android give 0 permissions to user, full permissions to group, and r-x permissions to others - equivalent to chmod 075. This confuses Samba server, which expects normal translation of the permissions.

Here's the link to my workaround - adding "map readonly = permissions". It works for Windows Vista and Windows 7 (most times).
http://xdaforums.com/showpost.php?p=7815708&postcount=111

This workaround doesn't solve everything - it only solves the problem when the share is being read from Windows Vista or 7 (and perhaps not in all cases), and with Windows XP it doesn't help at all. Samba server code needs to be adapted for the "wrong" FAT32 permissions translation on Android.

Thanks again for the great job you're doing.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 115
    Access the external storage card in your Android device over wifi as a shared folder

    Hi, thanks for your interest in this app!

    If you use it, please do post feedback about success, failure, suggestions for improvement etc. Be sure to include the app version you have installed (Menu -> Settings -> About), your Android device make, model & ROM version, and support log file if you are having problems (Menu -> Settings -> Create Support Log - send via PM or e-mail, please dont post the log to the forums).

    Am also interested to hear about copy xfer rates to/from your device. My HTC Hero gets between 700 KB/s to 1MB/s, my Asus Transformer about 2.5MB/s.

    This app requires your device to already have:
    - root access.
    - Superuser 2.3.6.2 or later, from Android Market (may work with other Android 'su' implementations but I havent tested with any others).


    Installation
    * The two most recent development builds are attached below.
    * Or you can Install the current Android Market version:


    On the first run, make sure you catch the SuperUser Auth request to allow the Samba Filesharing app root access.

    Also, the first run will be a bit slow, the app has to unpack some additional binaries into its private data space.

    GPL: Samba GPL licensing information including source code modification details are included in the app. Once installed go to Menu -> Settings -> About.

    - jc

    Screen shots (click to enlarge):

    110905main_full.png 110905prefs_01_full.png 110905prefs_02_full.png 110905prefs_03_full.png

    Change history


    If you like this app, please consider making a small donation. Not to me, but to one of the charities I strongly support: Cancer Research, or Animal Welfare.

    Dev builds attached below - To install: unzip, and either:
    - ADB: adb install SambaFilesharing<version>.apk
    - FileManager: Copy the APK to /sdcard on your device, then launch with a filemanager program (like Astro).
    (Dev build change history)



    To-Do list (in no particular order)
    - finish notification bar icon re-code
    - Add support for NTFS formatted sdcards.
    - Improve support for devices (eg Tablets) with multiple 'sdcard' type storage devices.
    - multiple/more configurable shared folders, multiple user accounts.
    - add in a CIFS mount manager
    - Improve available characters and lengths of username, password, workgroup, netbios-name fields.
    - toggle widget
    - Add option for persistent display of app 'Menu' button items.
    - move this page to the Android Apps and Games forum.

    (The below SambaFilesharing-dev-130413.zip is the the Google Play 140525 version with extra dev options turned on )
    21
    APP development page has moved to http://xdaforums.com/android/apps-games/app-samba-filesharing-server-android-t2803452/post53869540

    This thread is kept fir reference as it contains valuable information for manual modifications.
    14
    I need that fix ASAP. :)
    If you're keen :) you can try editing /data/data/com.funkyfresh.samba/files/samba-rc to add the chmod line to the start section after line 17:

    Code:
            ...
         7	SPIDFILE=$PRE/var/locks/smbd.pid
         8	NPIDFILE=$PRE/var/locks/nmbd.pid
         9	
        10	case "$1" in
        11		start)
        12	        $0 stop
        13		    $0 cleanup
        14		    $0 rmlogs
        15		    $PRE/nmbd -D
        16		    $PRE/smbd -D
        17		    sleep 1
        18		    [B]chmod 644 $NPIDFILE $SPIDFILE[/B]     # add this line chmod ...
        19		    echo ok
        20		    ;;
        21		stop)
            ...

    I'll include it in the next dev release. Let us know how you go with it.

    - jc
    7
    I'm ready with a beta version, please expect it tomorrow :)
    7
    Hey guys,

    Have unfortunately been absent from further recent development of the app, just to let you know i will be looking into the problems reported running it on Android JB, with the the aim of providing a fix in an updated version of the app in Play store - not yet sure whether it will still be a single one-size-fits-all updated APK , or (more likely) a newer package for JB versions and onwards to keep the package file sizes down. I dont have an ETA yet - ofcourse you'll hear about it first here on XDA : - ) First very quick pass glance seems to be a change in the default kernel support for 'older' Android binary native executables, some custom ROMs have their kernels built to still support the 'older' executabe format so its not an issue in them - am still to confirm that (willl rebuild my villec2 kernel in the next few days to confirm if thats [the only] change / problem i ned to cater for, (And ofcourse if you already know the cause and fix feel free to point me to a thread etc).

    And thanks to everyone who has provided troubleshooting information, assistance, work-arounds, and patches so far for the problems - and of course The core Samba Org Team, who already spent the many years developing the underlying open source Samba cross-platform code.

    - jc