Page 1 of 2 12 LastLast
Results 1 to 20 of 29

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Samba for Iphone

  1. #1
    Default Samba for Iphone
    http://wickedpsyched.com/iphone/samba/

    I just thought i would post this to the modmyi.community. Wickedpsyched.com is really great.

    SAMBA on iPhone

    only do this if you know what you are doing, this could expose all your data to the bad guys (tm)


    On the iphone after making a suitable smb.conf in /usr/local/samba/lib/
    and after a smbpasswd setup:

    sh-3.2# ps aux | grep smb
    root 678 0.0 0.0 263760 240 p1 R+ 8:08PM 0:00.01 grep smb

    Start daemons:

    -bash-3.2# smbd -D
    -bash-3.2# nmbd -D
    -bash-3.2# ps aux | grep mb
    root 680 0.0 0.0 277392 1120 ?? Ss 8:08PM 0:00.19 smbd -D
    root 681 0.0 0.0 277392 272 ?? S 8:08PM 0:00.01 smbd -D
    root 683 0.0 0.0 274744 488 ?? Ss 8:08PM 0:00.01 nmbd -D


    Back on imac, or pc client we can list the services:

    [imac:~] % smbclient -L iphone -Uroot
    Password:
    Domain=[JAMES'S IPHONE] OS=[Unix] Server=[Samba 3.0.25c]

    Sharename Type Comment
    --------- ---- -------
    IPC$ IPC IPC Service (Samba Server on iPhone)
    root Disk Home Directories

    Domain=[JAMES'S IPHONE] OS=[Unix] Server=[Samba 3.0.25c]

    Server Comment
    --------- -------

    Workgroup Master
    --------- -------
    IPHONES JAMES'S IPHONE



    After mounting via finder:



    (currently only root is allowed to login due to GID/UID issues)


    However it works rather well:

    [imac:~] % ls -ltra /Volumes/
    Macintosh HD@ ramdisk/ iphoneroot/


    [imac:~] % ls -ltra /Volumes/iphoneroot/
    total 570
    drwx------ 1 root admin 16384 May 22 23:54 cores
    drwx------ 1 root admin 16384 Jul 23 19:04 Library
    drwx------ 1 root admin 16384 Aug 11 01:02 private
    drwx------ 1 root admin 16384 Aug 11 01:34 sbin
    drwx------ 1 root admin 16384 Aug 11 01:34 libexec
    drwx------ 1 root admin 16384 Aug 11 01:34 System
    drwx------ 1 root admin 16384 Aug 11 11:15 home
    drwx------ 1 root admin 16384 Aug 11 16:56 usr
    drwx------ 1 root admin 16384 Aug 12 16:25 Users
    drwx------ 1 root admin 16384 Aug 12 16:42 iphoneperl
    drwx------ 1 root admin 16384 Aug 18 18:04 var
    drwx------ 1 root admin 16384 Aug 21 17:39 dev
    drwx------ 1 root admin 16384 Aug 22 00:27 Applications
    drwx------ 1 root admin 16384 Aug 22 17:08 etc
    drwx------ 1 root admin 16384 Aug 22 17:24 bin
    drwx------ 1 root admin 16384 Aug 22 20:08 tmp
    drwxrwxrwt 6 root admin 204 Aug 22 20:10 ..
    drwx------ 1 root admin 16384 Aug 22 20:10 .
    -rwx------ 1 root admin 12292 Aug 22 20:10 .DS_Store


    Reading and writing works:

    [imac:~] % cd /Volumes/iphoneroot/tmp

    [imac:/Volumes/iphoneroot/tmp] % ls
    -T0x2846480.tmp.1AI241 -T0x2846480.tmp.KDCRSO MediaCache launchd
    -T0x2846480.tmp.3s94SE -T0x2846480.tmp.ZsX60h UpdatedSnapshots

    [imac:/Volumes/iphoneroot/tmp] % touch hello
    [imac:/Volumes/iphoneroot/tmp] % echo test > hello
    [imac:/Volumes/iphoneroot/tmp] % cat hello
    test
    [imac:/Volumes/iphoneroot/tmp] % rm hello
    [imac:/Volumes/iphoneroot/tmp] % cat hello
    cat: hello: No such file or directory

    Looks like this in the GUI:





  2. The Following User Says Thank You to exoram For This Useful Post:

    drunix (11-17-2007)

  3. #2
    can this be used to print to printers via samba?

  4. #3
    Default Smaba
    This doesnt tell anyone how to install it. Is there a step by step on this?

  5. #4
    Smile Howto install samba on your iphone
    Here is a link to a step by step doc. I though together

    http://signalblue.com/iphone/iphone-smb-howto.html

    hope it helps.

    It actually works well give it a shot. I use the files share kinda of like a usb disk drive. Also load ringtones etc.

    How to run samba on your iphone

    Below is a cut and paste of the howto doc (html link above has screenshots)

    This doc is a step buy step on howto install and configure samba on you iphone. Following these step will allow you to connect to iphone from windows or mac as a network share. This connection direct to iphone via adhoc network. But if you want to route it behind a firewall will work fine as well

    Assumptions
    I assume your iphone is freed and able to install 3rd party apps and you already have sshd enabled if you do not you will need to complete that step before continuing.

    Install Details
    I have simplified the config files and removed many advanced setting so be warned default value are in place. If you want to further secure the share you will need to add to the config in. The install files were striped of binary that are not needed to try to save space if you want full/advanced functionallity please download the full tar ball from http://wickedpsyched.com/iphone/samba/ . (Thanks x for provide the original binaries) Logging is also set to minimal and redirected away from root, this was done so that root file system will not fill up with logs and crash your phone. If you want to get debug message you will need to modify the logging level. I do not go into the security concerns of running smb (I assume you know what you are doing when you enable network file sharing).

    Lets get started

    0. Prerequisite
    Download iPhone samba files
    http://signalblue.com/iphone/iphone_samba-v1.tar
    (stripped down)
    This tarbal contains minimal smb.conf, iphone specific startup scripts and default user passwd file.
    Download winscp (only needed if you are running windows. If you are using Linux or any other unix base os install openssh then use ssh)
    http://signalblue.com/iphone/tools/winscp.exe
    Download putty (only needed if you are running windows. If you are using Linux or any other unix base os install openssh then use scp)
    http://signalblue.com/iphone/tools/putty.exe

    (if you are on mac use a shell, rbrowser or you any other ssh/scp client )

    Step1. Prepare iphone

    Disable Auto-Lock feature (auto lock will terminate you ssh and smb connections) Note make sure to re-enable it when you are not using the network features.

    I like to create a peer-to-peer network that way I can connect my phone wirelessly to my laptop when I am at the airport.
    (if you are using a access-point and have a natted ip you can just use it)
    Now create a peer-to-peer you mac or pc
    I have pc screen shots because I don't have a mac. Hopefully that will soon be rectified son :-)

    Go to iphone. and turn off WiFi
    From the menu Settings>General>Network>WiFi>Then select off

    Disable Wep and enter iphone-net as SSID and set as ad-hoc

    Set ip address as 192.168.1.201

    Settings>General>Network>WiFi> Then select enable Wifi
    You should see a SSID iphone-net
    Select it and configure ip as static
    The smb config file is already setup for 192.168.1.200
    So if you want to make it easy on yourself just
    set your ipaddress to 192.168.1.200
    set your netmask to 255.255.255.0
    go back to WiFi - Networks
    and check iphone-net
    You should now be connect to iphone on a peer-to-peer wifi link
    Open a cmd shell and ping iphone

    Step 2: Upload samba tarball
    Login in to iphone
    username:root
    password dottie

    Copy iphone_samba.tar to root


    Step 3: Login via putty and run the following command

    Note: All command should be ran with out # sign (But I am sure you new that)

    #mv iphone_samba-v1.tar /usr/local
    #cd /usr/local
    #ls -l
    -rw-r--r-- 1 root wheel 9195520 Oct 15 02:43 iphone_samba-v1.tar

    # tar -xvf iphone_samba-v1.tar
    samba/
    samba/lib/
    samba/lib/smb.conf
    samba/libsmbsharemodes.a
    samba/nmbd
    samba/private/
    samba/private/secrets.tdb
    samba/private/smbpasswd
    samba/smbd
    samba/smbpasswd
    samba/smbstatus

    #touch /etc/printcap
    #mkdir -p /var/root/apps/log/var
    #mkdir -p /var/root/Media/ROMs
    #mkdir -p /var/root/Media/PDF
    #mkdir -p /var/root/Media/Files


    # cd samba
    # ls -l
    total 8960
    drwxr-xr-x 2 root wheel 102 Oct 15 02:42 lib
    -rw-r--r-- 1 root wheel 6200 Oct 15 00:14 libsmbsharemodes.a
    -rwxr-xr-x 1 root wheel 1519224 Oct 15 00:14 nmbd
    drwxr-xr-x 2 root wheel 136 Oct 15 02:18 private
    -rwxr-xr-x 1 root wheel 4166552 Oct 15 00:14 smbd
    -rwxr-xr-x 1 root wheel 2354852 Oct 15 00:14 smbpasswd
    -rwxr-xr-x 1 root wheel 1121748 Oct 15 00:14 smbstatus

    #ln -s /var/root/apps/log/var (This will make sure that you do not fill up your root fs with logs)
    Note: I recommed deleting the logs every once in a while to conserve space.

    the first time you start samba the following files will be created
    drwx------ 4 root wheel 136 Oct 15 03:20 cores
    drwxr-xr-x 4 root wheel 748 Oct 15 03:27 locks
    -rw-r--r-- 1 root wheel 982 Oct 15 03:27 log.nmbd
    -rw-r--r-- 1 root wheel 2185 Oct 15 03:27 log.smbd

    Step 4: Start Samba on iphone
    You can do this from the iphone if you have mobile terminal installed
    If not log in via putty and start it
    command

    #/usr/loca/samba/smb.sh start
    To stop service just use /usr/local/samba/smb.sh stop

    Step 5: Connect to iphone (and mount share)
    On windows Start >Run > \\192.168.1.200
    On mac use network connect
    On linux use smbclient

    Step 6: Login
    Default user in the passwd file is root password is iphone
    Note you can use smbpasswd to create other uses (You will need to how to map uid and gid to file perms to map)
    If you dont know what that mean I would worry about it use root/iphone (a change of passwd is recommend)
    you can do that via the command #smbpassd root from the ssh session.

    If all goes well your iphone shares should be displayed

    Enjoy

    Last reminder: I would disable smb when not used (I would be nice to create a native app that can disable and enable services)
    Also
    Renable auto lockout when you don't use network services. (Alway secure you phone)

    Anthony Vattathil
    Last edited by anthonyv; 10-28-2007 at 01:44 PM.

  6. The Following User Says Thank You to anthonyv For This Useful Post:

    drunix (11-17-2007)

  7. #5
    @!#$@#$@ THIS IS GREAT !!!!!

    WORKS LIKE A CHARM BUT......

    tar file is damaged, it will decompress ok but ull need to remove the file called var "rm var"

    and create a directory called var "mkdir var"

    then u can start samba and life will b beautiful also check my iphone as modem post to make ur iphone perfect!! "almost"

    http://www.modmyi.com/forums/showthr...t=iphone+modem

  8. #6
    Default SAMBA on the Iphone ?
    I have atempted this with no luck on an iphone with 2.1. Everytime I try to start the samba service (/usr/local/samba/smb.sh start) the I get the following output:

    /usr/local/samba/smb.sh line 5: 233 Killed /usr/local/samba/smbd -D
    /usr/local/samba/smb.sh line 5: 234 Killed /usr/local/samba/nmbd -D



    I assume having used linux and other various unix systems for years that the 233 and 234 are process IDs. I cant to seem to find any logs left behind by smbd so it is hard to tell just what the problem is. Took a look at the smb.sh file and it seems very simple. I can only assume the this may not work with the 2.1 build of the iphone? Anybody got any ideas? Every proces I run in using either the How to run samba on your iphone package or the Samba and CIFS | CoreOS - iPhoneUnix package; the binaries output says Killed, is there something I am misssing? Any help would be greatly appreciated.


  9. #7
    What's Jailbreak?
    Join Date
    Dec 2008
    Location
    Ohio USA
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Angry Re: Killed
    mr gadget, I am having the exact same problem.
    Both archives of samba i could find (same links you had) won't execute.

    You can test that it is the binary executable by:
    cd /usr/local/samba/
    ./smbd -D
    Killed

    localhost:/usr/local/samba root# file smbd
    smbd: Mach-O executable acorn

    Still no idea why. I checked apt for ptrace, but could not find it. I'm from a linux background, so arn't even sure if ptrace is the right program for osx.

    /usr/local is on disk0s1 as the root volume, so there shouldn't be a problem with the fact disk0s2 mounted on /private/var/ is flagged noexec in fstab.

    I've used bossprefs to remove the apple killswitch app, just in case apple started using it to ban programs.
    I also copied the smbd binary to / named testing and got the same error when running it.

    If anyone has managed to get samba working on 2.1 (and/or newer) can you please share the secret?

    Thanks -- Dissy

  10. #8
    Default smbd error
    I have the same problem: smbd does not START!!

    Somebody has found how to start samba on iphone?

  11. #9
    This is more than likely the iPhones code signature check killing it. Try this to bypass it:

    iphone# apt-get install ldid
    iphone# ldid -S /usr/local/samba/smdb
    iphone# ldid -S /usr/local/samba/nmdb

  12. The Following User Says Thank You to drivesoslow For This Useful Post:

    razback (02-10-2009)

  13. #10
    Thanks to drivesoslow for your hint! Seems we're one step further, as the error message has changed after signing the binaries ;-)

    I almost gave up though, as there was a small typo:

    iphone# apt-get install ldid
    iphone# ldid -S /usr/local/samba/smbd
    iphone# ldid -S /usr/local/samba/nmbd
    The new error message is:

    iphone starting samba:
    dyld: Library not loaded: /usr/lib/libgcc_s_v6.1.dylib
    Referenced from: /usr/local/samba/smbd
    Reason: image not found
    /usr/local/samba/smb.sh: line 5: 3061 Trace/BPT trap /usr/local/samba/smbd -D
    dyld: Library not loaded: /usr/lib/libgcc_s_v6.1.dylib
    Referenced from: /usr/local/samba/nmbd
    Reason: image not found
    /usr/local/samba/smb.sh: line 5: 3063 Trace/BPT trap /usr/local/samba/nmbd -D
    cat: /usr/local/samba/var/locks/*.pid: No such file or directory

    I found one post here, containing the same error message: http://www.hackint0sh.org/forum/f126/53252-2.htm

    The solution in that case was to get /usr/lib/libgcc_s_v6.1.dylib off the 1.1.4 firmware. Unfortunately I haven't been too lucky in extracting the lib. All the firmwares I downloaded contain .dmg images that I can't open.

    Could anyone get a hold of libgcc_s_v6.1.dylib or of an extracted 1.1.4 firmware?

    Here's the direct download to the 1.1.4 firmware image:
    http://appldnld.apple.com.edgesuite....2_Restore.ipsw

    (Rename .ipsw to .zip to open it on a PC)

    Please let me know if you have any progress.
    Last edited by razback; 02-09-2009 at 12:53 PM.

  14. #11
    Have you tried linking /usr/lib/libgcc_s_v6.1.dylib to /usr/lib/libgcc_s.10.4.dylib or /usr/lib/libgcc_s.10.5.dylib

  15. #12
    Nice try, but that just resulted in "can't map".

    for libgcc_s.10.5.dylib:
    iphone starting samba:
    dyld: Library not loaded: /usr/lib/libgcc_s_v6.1.dylib
    Referenced from: /usr/local/samba/smbd
    Reason: no suitable image found. Did find:
    /usr/lib/libgcc_s_v6.1.dylib: can't map
    /usr/lib/libgcc_s_v6.1.dylib: can't map
    /usr/local/samba/smb.sh: line 5: 3096 Trace/BPT trap /usr/local/samba/smbd -D
    dyld: Library not loaded: /usr/lib/libgcc_s_v6.1.dylib
    Referenced from: /usr/local/samba/nmbd
    Reason: no suitable image found. Did find:
    /usr/lib/libgcc_s_v6.1.dylib: can't map
    /usr/lib/libgcc_s_v6.1.dylib: can't map
    /usr/local/samba/smb.sh: line 5: 3098 Trace/BPT trap /usr/local/samba/nmbd -D
    cat: /usr/local/samba/var/locks/*.pid: No such file or directory

    (Similar for libgcc_s.10.4.dylib)

    As for the firmware, after doing some research I finally found out that the .dmg must be decrypted first: Decrypt Firmware 1.1.3 / 1.1.4 - uDơDHD

    Unfortunately, the (Windows) library download for vfdecrypt, that is needed to decrypt the dmg is broken:
    http://pecl4win.php.net/download.php...2/libeay32.dll

    So I guess I'll just wait for it to come back to life and try again later. In any case. thanks for your help!

  16. #13
    I finally managed to extract libgcc_s_v6.1.dylib from the 1.1.4 firmware. I put it in place and got the well-know error message

    iphone starting samba:
    /usr/local/samba/smb.sh: line 5: 3478 Killed /usr/local/samba/ smbd -D
    /usr/local/samba/smb.sh: line 5: 3479 Killed /usr/local/samba/ nmbd -D
    cat: /usr/local/samba/var/locks/*.pid: No such file or directory

    So I signed it using ldid and got

    iphone starting samba:
    dyld: code signature failed for /usr/lib/libgcc_s_v6.1.dylib with errno=22
    /usr/local/samba/smb.sh: line 5: 3506 Killed /usr/local/samba/smbd -D
    dyld: code signature failed for /usr/lib/libgcc_s_v6.1.dylib with errno=22
    /usr/local/samba/smb.sh: line 5: 3507 Killed /usr/local/samba/nmbd -D
    cat: /usr/local/samba/var/locks/*.pid: No such file or directory


    I don't understand the error message, but something tells me that maybe libgcc_s_v6.1.dylib isn't compatible with the 2.1 firmware at all. I guess I'll just give up for now unless somebody has a new idea.

    Hopefully somebody starts implementing their own Samba implementation - I reckon there's a huge demand for network sharing.

  17. #14
    Code:
    mkdir /usr/local/samba/var/locks/
    Also I tried compiling samba on my phone but it reboots my phone during the linking process
    Last edited by drivesoslow; 02-16-2009 at 12:48 PM. Reason: Automerged Doublepost

  18. #15
    What's Jailbreak?
    Join Date
    Nov 2007
    Posts
    25
    Thanks
    1
    Thanked 2 Times in 1 Post
    I tried the same exact thing and see the same errors with FW 2.1. This sucks. I had before 1.1.4 and samba was working fine, after upgrading to 2.1 no more.

  19. #16
    What's Jailbreak?
    Join Date
    Nov 2008
    Location
    England
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Same problem here, getting the following (iPhone 3G 2.2 FW)

    localhost:/usr/bin root# uname -a
    Darwin localhost 9.4.1 Darwin Kernel Version 9.4.1: Sat Nov 1 19:09:48 PDT 2008; rootnu-1228.7.36~2/RELEASE_ARM_S5L8900X iPhone1,2 arm N82AP Darwin
    localhost:/usr/local/samba root# /usr/local/samba/smb.sh start
    iphone starting samba:
    /usr/local/samba/smb.sh: line 5: 1436 Killed /usr/local/samba/smbd -D
    /usr/local/samba/smb.sh: line 5: 1437 Killed /usr/local/samba/nmbd -D
    Any pointers in the right direction would be much appreciated!
    Last edited by XVar; 03-10-2009 at 06:13 AM.

  20. #17
    Did you read this thread by any chance? Look at post #9

    iphone# apt-get install ldid
    iphone# ldid -S /usr/local/samba/smbd
    iphone# ldid -S /usr/local/samba/nmbd

  21. The Following User Says Thank You to drivesoslow For This Useful Post:

    FaceBooger (06-26-2009)

  22. #18
    What's Jailbreak?
    Join Date
    Nov 2008
    Location
    England
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Well I assumed since razback didn't have any success with that then neither would I. It turns out I was right, exact same error messages.

  23. #19
    What's Jailbreak?
    Join Date
    Nov 2008
    Location
    England
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Anyone got any ideas how to fix this?

  24. #20
    Quote Originally Posted by drivesoslow View Post
    Code:
    mkdir /usr/local/samba/var/locks/
    Also I tried compiling samba on my phone but it reboots my phone during the linking process
    How did you get past this error, with Option #3 on Bypassing iPhone Code Signatures - Jay Freeman (saurik) ?

    Code:
    Electronic-Victrola:/var/samba-3.3.2/source root# ./configure --disable-largefile 
    SAMBA VERSION: 3.3.2
    ...
    checking whether the C compiler works... configure: error: in `/var/samba-3.3.2/source':
    configure: error: cannot run C compiled programs.
    Move along, nothing to see here.

Page 1 of 2 12 LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •