10

Does iOS (or iPhone OS) support file operations via SMB network shares? If so, are there any documents about how to do this?

Dieter
  • 191
  • 1
  • 1
  • 6

6 Answers6

8

Don't have tested yet but this might help: http://38leinad.wordpress.com/2011/03/23/windows-filesharing-library-for-ios/

Valentin Jacquemin
  • 2,215
  • 1
  • 19
  • 33
4

I thought I made it work between macbook and my iPhone simulator however it never worked for folders shared on windows machine .. please refer to a separate question I have posted - Using NSNetService class to make an SMB tcp ip connection to a folder shared on windows machine - with steps I have taken ...

Community
  • 1
  • 1
smile.al.d.way
  • 361
  • 5
  • 17
  • 1
    You did not make it work at all. As the answer to your linked question states, `NSNetService` is related to Bonjour-based service discovery. It has nothing to do with actually communicating via the SMB protocol. – lemnar Aug 29 '11 at 01:14
  • You are right. I posted this before I received answer to the linked question. Most of the confusion is due to lack of documentation on what "type" parameter does in following line of code `self.netService = [[[NSNetService alloc] initWithDomain:@"10.212.19.121" type:@"_smb._tcp." name:@"lanmanserver"] autorelease]` – smile.al.d.way Aug 29 '11 at 19:27
1

Not sure about SMB, but I was able to read/write files on a jailbroken IPad using SFTP. OS versions 4.1, 4.2, 4.3.

On a side note, I think that the question needs a bit of clarification - what exactly are you trying to do, and whether you're working with a regular or a jailbroken device. Answers may vary greatly one knowing these things.

dbozhinovski
  • 523
  • 6
  • 19
0

I used libsmbclient from samba package for SMB operations on iOS. You can look on my project https://github.com/kolyvan/kxsmb (objective-c wrapper on libsmbclient). For now it supports a limited set of SMB operations. It mostly was designed for browsing local net and retrieving files from SMB shares.

Kolyvan
  • 501
  • 4
  • 8
  • `libsmbclient` is GPL, which means any iOS app that uses with it needs to be GPL as well. – adib Nov 15 '13 at 15:55
0

iOS does not have any APIs to work with SMB. However, SMB is currently documented by Microsoft and implementing it is not impossible (although not easy too). I've created a freeware project which contains most of what you need to handle SMB. See

https://sourceforge.net/projects/smb4ios/

It does not use Samba or any other heavy-weight libraries. Works mostly for printers, but with what's already there it's easy to add support for file handling or whatever.

I don't care about GPL stuff, you can just reuse the code without concerns for that. Just check if the NTLM library I used has the correct license for you (or implement your own NTLM).

Nick Frolov
  • 1,835
  • 18
  • 14
  • does only implement the now obsolete samba v1 (e.g. windows xp compatible) – bernstein Aug 22 '14 at 16:59
  • Correct. My task required support for XP, because ATM there's still a lot of XP machines in existence. Otherwise I would go with SMB 2, which is a better format. – Nick Frolov Aug 26 '14 at 04:42
  • I tried this on macOS sierra (targeting an iOS 10 device). I tried connecting to the localhost SMB share, and it failed with ntstatus NOT_SUPPORTED, presumably because this is a v1 client and the sierra SMB is probably v2. I tried connecting to a share on an airport extreme (the point of my app) and it failed with ntstatus NOT_IMPLEMENTED, indicating the airport extreme doesn't support something. Either way, out of luck. Good work on the smb4ios project though, it's cool to have OSS code out there like that. – Orion Edwards Nov 20 '16 at 18:47
  • Note: This depends on libntlm, and only bundles a 32 bit version. These days things need to be 64 bit. I replaced it (at the source code level, not linking a library) Libntlm from here http://www.nongnu.org/libntlm/ and it seemed fine, but it was a fair bit of work to swap that out – Orion Edwards Nov 20 '16 at 18:51
0

You may also refer to my experience, I managed to implement a SMB client for iOS : SMB/samba support on iOS?

Community
  • 1
  • 1
Qiulang
  • 10,295
  • 11
  • 80
  • 129