Remove All Ads from XDA

[APP] Samba Server for Android

8,837 posts
Thanks Meter: 3,043
By FadeFx, Senior Member on 27th March 2010, 02:28 PM
Post Reply Email Thread
APP development page has moved to

This thread is kept fir reference as it contains valuable information for manual modifications.
The Following 21 Users Say Thank You to FadeFx For This Useful Post: [ View ] Gift FadeFx Ad-Free
30th March 2010, 03:08 PM |#2  
DAGr8's Avatar
Inactive Recognized Developer
Thanks Meter: 6,382
Donate to Me
hey there I was lookin for similar feature , its not exactly the sme well it is , but anyways , Estrong Explorer does the job for what you are tryin to do , ( ESexplorer) free inmarket . as long as phone is reg on network it will access your share
14th April 2010, 12:10 PM |#3  
Senior Member
Flag Melbourne
Thanks Meter: 226
Hi, I just got Samba server (2.2.12) working on my HTC Hero. The daemons smbd+nmbd take up just under 4Mb memory when running (and opening a shared folder on the phone from a computer on the network will launch another smbd daemon, which is about 2.5Mb).

The main problem I'm having is slow xfer rates - seems to max out at 600 - 700Kb/s. Its the same if i SCP files though, so I dont think its a problem is with samba specifically...

I can provide a tarball with the files if you want to try it out (install & configuration is through a root shell, its all pretty basic at the moment).

- Jimmy
22nd April 2010, 09:48 PM |#4  
Senior Member
Thanks Meter: 974
By all means, I'd like to try it on my Nexus. Just finished a thread about changing Nexus One's hostname from default "localhost", and understood that besides my router, I can't do much with it on Windows network w/o DNS
Please post the files & instructions.
1st May 2010, 08:23 AM |#5  
Senior Member
Flag Melbourne
Thanks Meter: 226
Have attached a zip file containing the samba files + README.txt with basic install instructions. Access the phone shared folder via Windows network browsing, or with \\IPaddress of the phone.

** See a later post by me in this thread that has a newer version of Samba attached which includes automated install/uninstall script.
Attached Files
File Type: zip - [Click for QR Code] (2.60 MB, 3933 views)
File Type: txt README.txt - [Click for QR Code] (5.6 KB, 3592 views)
The Following User Says Thank You to JimmyChingala For This Useful Post: [ View ] Gift JimmyChingala Ad-Free
10th May 2010, 12:35 PM |#6  
Senior Member
Thanks Meter: 974

I've checked the most recent version and the one before it, on Nexus.
Both exhibit the same behavior.

1) When trying to unzip to SD card, everything's ok and the default file attributes are preserved. When extracting to /data/local, no matter which way is used, "executable" attributes aren't preserved - only RW attributes. chmod +rwx samba/bin/* doesn't help, and when trying to execute "samba-rc start" via Terminal on the phone, it shows: "ash: can't find samba-rc" (I'm using ash). Using "su samba-rc start" also doesn't help, it shows "permission denied".

2) Trying to execute smbpasswd - it asks for a new password and confirmation, and crashes with segmentation fault.

3) Trying to execute samba-rc from ADB SHELL didn't throw any error messages, but it didn't work either.
11th May 2010, 12:54 PM |#7  
Senior Member
Thanks Meter: 974
I've tried both running from the phone's terminal emulator and by adb shell (I don't open the shell continuously, I run each command separately - adb shell "command", this way I can dump the output to PC by adding > in the end).

/data/local/samba/bin/nmbd -i -d 99

Looks like it's working, both from phone's terminal emulator and from adb shell. I see the Nexus being discovered by Windows 7 workstation on network scan (I've personalized the name - read my thread in Nexus development section on how to do that). nmbd_log attached, to check that everything's ok.

/data/local/samba/bin/smbd -i -d 99

Here the things start getting more interesting.
1) If I try to connect, after some time the smbd stops by itself - looks like after 5 failed attempts the server auto-stops itself. That's not a good behavior, especially considering that while Windows prompts you for username and password to connect, it also keeps trying to auto-connect using the default username (that's where 5 attempts come from). The server shouldn't stop itself. smbd_log1 attached.
2) If I write the user on time, smbd crashes while trying to compare passwords. smbd_log2 attached.

All the logs are zipped.
Attached Files
File Type: zip - [Click for QR Code] (13.8 KB, 337 views)
14th May 2010, 03:02 AM |#8  
Senior Member
Flag Melbourne
Thanks Meter: 226
Thanks for the info Jack.

With the shell script, can you try running it like:

sh -c "/data/local/samba/bin/samba-rc restart"

if that still doesnt work, as a further test, open two root sessions via adb shell, in one run the nmbd command, in the other run the smbd (both with same options as before) then try browsing again from your computer.

Note: dont let your phone go into sleep mode (keep the screen active so the display stays on).

- JC
17th May 2010, 10:17 AM |#9  
Senior Member
Thanks Meter: 974
I had a chance to play with both versions some more.

1) using su and no shell (not running ash) I can run samba-rc, and it executes correctly. Both processes (nmbd and smbd) show up in ps. To achieve that, I needed to chmod +rwx /samba/bin/* after unzipping.

2) nmbd works well, and the phone shows up on Windows network.

3) It still doesn't allow logging into it, and I believe the problem lies in smbpasswd executable, which still shows erroneous behavior:

Tried to login using default user bogan: "network resource not available" message coming from Windows upon entering login credentials. Phone stays on the network and can be accessed again, but login is still impossible.

Tried to change default user's password: smbpasswd asks for new password twice (without asking for the old one - which is wrong behavior!) and crashes with segmentation fault.

Tried removing /samba/private/smbpasswd file and creating a new one, using smbpasswd -add username. Worked, but no password was asked for the user.

Tried to change password for new username. The same as before - asked for new password twice, then crashed with segmentation fault.

When tried to login with the new user, it didn't show "network resource not available", but it kept asking for password (the dialog where username is already there, and only the password needs to be retyped). I didn't know the default password that smbpasswd creates, if any. Tried nothing, tried several basic options (root, same as username, etc), none worked.

I believe the problem might be smbpasswd not working correctly on Android 2.1.
19th May 2010, 06:42 PM |#10  
DocMAX's Avatar
Senior Member
Thanks Meter: 24
ich started samba via chroot debian. i can read and write the filesystem.. except mapped /sdcard... i cannot delete files... any ideas how to set permissions? the user is 1000 and group is 1015
19th May 2010, 07:14 PM |#11  
Senior Member
Thanks Meter: 974
Played some more with it, and I can definitely point at authentication as the source of the problems. I got it to work. Not too well - because it lacks any security whatsoever - but at least it works.

First, about the problems:

When mistyping the password one of the times, smbpasswd shows correct error message and gracefully exits.
When doing everything correctly, it crashes - but writes /private/smbpasswd file before that.
I've tried to run it with debug level = 9, it showed lots of info when starting, and after changing passwords - just the regular "Segmentation fault" crash.

in smb.conf, setting password encryption = off causes the Windows to throw "this user isn't authorized to login from this station" error instead of asking for username.

But, how I got things to work?
Well, since I was certain that it's the authentication mechanisms that prevent it from working, I prevented those authentication mechanisms from functioning. At first I wanted to ask Jimmy for a test version that would ignore user/password checking, but then I thought that I might do it in smb.conf file. So here is what I did:

security = SHARE # instead of USER

guest ok = yes # instead of no

With these settings, I get no password prompts and Samba works! I see SD card share, and can copy to/from it.

* The main script (samba-rc) works well in killing all the smbd processes on stop/restart.
* Server still runs when the phone is in sleep mode, just much slower.

Jimmy, could you please test smbpasswd compilation to find out why it crashes on 2.1 (I'm running Cyanogen 5.0.6)? Once it's done, I believe that this will work anywhere.

Also, something could probably be done to make it speed up CPU / network on demand when the phone is sleeping, or to prevent the phone from sleeping while it's running - and a GUI can be made for controlling it, since it'll be fully functional.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes